Write a function in Java that implements the following logic: Given a string str
and a non-empty word
, return a version of the original...
Search Results
Searching for: conditional
Individual Exercises
Write a function in Java that implements the following logic: Given two strings, a
and b
, create a bigger string made of the first...
Given a string str
, find all places where a three-letter combination starting with "z" and ending with "p" occurs. Return a string where...
Write a function in Java that implements the following logic: Given a string str
and a non-empty word
, return a string made of each...
Write a function in Java that counts the number of times the string "code" appears anywhere in the given string str
, except that we'll...
Given two strings, return true if either of the strings appears at the very end of the other string, ignoring upper/lower case...
Write a function in Java that returns true if the given string str
contains an occurrence of the substring "xyz" where "xyz" is not...
We'll say that a string is xy-balanced if for all the 'x' characterss in the string, there exists a 'y' character somewhere later in the...
A sandwich is two pieces of bread with something in between. Write a Java method that takes in a string str
and returns the string that...
Write a function in Java that takes an int
array as its parameter and returns the number of even int
s it contains. Note: the %
"mod"...
Given an int
array, return the sum of the numbers in the array, except ignore sections of numbers starting with a 6 and extending to the...
We'll say that a value is "everywhere" in an array if for every pair of adjacent elements in the array, at least one of the pair is that...
Given an int[]
array, write a function that returns an array where all the 10's have been removed. The remaining elements should shift...
Write a function in Java that takes an array and returns the sum of the numbers in the array, or 0 if the array is empty. Except the...
Given an array of int
values, return true if the array contains either 3 even or 3 odd values all next to each other.
For each multiple of 10 in the given array, change all the values following it to be that multiple of 10, until encountering another...
For this problem, we'll round an int
value up to the next multiple of 10 if its rightmost digit is 5 or more, so 15 rounds up to 20....
We want make a package of goal
kilos of chocolate. We have small bars (1 kilo each) and big bars (5 kilos each). Return the number of...
Given a string, if the same 2-character substring appears at both its beginning and end, return the contents of the string without the...
Write a function in Java that implements the following logic: Return a version of the given array where each zero value in the array is...
Given a non-empty array of type int
, return a new array containing the elements from the original array that came before thefirst 4 in...
Given an array of int
values, return true if the group of n
numbers at the start of the array is the same as the group of n
numbers at...
Say that a "clump" in an array is a series of 2 or more adjacent elements of the same value. Return the number of clumps in the given...
Given an array, return an array that contains exactly the same numbers as the original array, but rearranged so that every 4 is...
Given a string, does "xyz" appear in the middle of the string? To define middle, we'll say that the number of chars to the left and right...