Given a string that contains a single pair of parenthesis, compute recursively a new string containing only the parentheses and their...
Search Results
Individual Exercises
Given a string and a non-empty substring sub
, compute recursively if at least n
copies of sub
appear in the string somewhere, possibly...
Given a string str
and a non-empty substring sub
, compute recursively the largest substring which both starts and ends with sub
and...
Given a string, return true
if it is a nesting of zero or more pairs of parentheses, like "(())" or "((()))". Suggestion: check the first...
Given a string, compute the number of times lowercase "hi" appears in the string. Make the countHi
be recursive.
Count recursively (no loops) the total number of "abc" and "aba" substrings that appear in the given string.
Given a string, compute recursively (no loops) a new string where all the lowercase 'x' chars have been changed to 'y' chars.
Given base
and n
that are both 1 or more, compute recursively (no loops) the value of base
to the n
power, so powerN(3, 2)
is 9 (3...
We'll say that a "pair" in a string is two instances of the same character separated by another character. So in "AxA", the A's make a...
Given a string, return a recursively "cleaned" string where adjacent chars that are the same have been reduced to a single char. So...
Given an array of int
s, compute recursively if the array contains somewhere a value followed immediately by that same value times 10....
Given a string, compute recursively a new string where all the 'x' chars have been removed.
Given an array of int
s, compute recursively if the array contains a 6. We'll use the convention of considering only the part of the array...
Given a non-negative int n
, return the count of the occurrences of 7 as a digit, so for example 717 yields 2. (no loops). Note that mod (...
Given a string, compute recursively (no loops) a new string where all appearances of "pi" have been replaced by "3.14".
Given a day of the week encoded as 0 = Sun, 1 = Mon, 2 = Tue, ... 6 = Sat, and a boolean indicating if we are on vacation, return a...
The number 6 is a truly great number. Given two int
values, a
and b
, return true if either one is 6. Or if their sum or difference is 6....
When squirrels get together for a party, they like to have cigars. A squirrel party is successful when the number of cigars is between 40...
You and your date are trying to get a table at a restaurant. The parameter you
is the stylishness of your clothes, in the range 0..10,...
You have a green lottery ticket, with int
s a
, b
, and c
on it. If the numbers are all different from each other, the result is 0. If all...
Write a method called listUpper()
that takes in a list of strings, and returns a list of the same length containing the same strings but...
Write a method called listSearch()
that takes in a target string and a list of other strings. This method returns a (possibly shorter)...
Which of the following JUnit tests will fail?
Roxy has written a method to count the number of people in her neighborhood, excluding children under 16 and individuals who are only...
Given a string str
and an int n
, return a string made of the first n
characters of the string, followed by the first n - 1
characters of...