# Search Results

Searching for: conditional

## Individual Exercises

0 / 50

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...

0 / 50

Return `true` if the string "cat" and "dog" appear the same number of times in the given string.

0 / 50

Return true if the given string contains a "bob" string, but where the middle 'o' character can be any character.

0 / 50

Given a string, count the number of words ending in 'y' or 'z'--so the 'y' in "heavy" and the 'z' in "fez" count, but not the 'y' in...

0 / 50

We have bunnies standing in a line, numbered 1, 2, ... The odd bunnies (1, 3, 5, ...) have the normal 2 ears. The even bunnies (2, 4,...

0 / 50

Given a non-negative int `n`, return the sum of its digits recursively (no loops). Note that mod (`%`) by 10 yields the rightmost digit (126...

0 / 50

Given a non-negative int `n`, compute recursively (no loops) the count of the occurrences of 8 as a digit, except that an 8 with another 8...

0 / 50

Given an array of `int`s, compute recursively the number of times that the value 11 appears in the array (no loops). We'll use the...

0 / 50

Given a string, compute recursively a new string where all the adjacent chars are now separated by a "*". So given "hello", return...

0 / 50

Given a string that contains a single pair of parenthesis, compute recursively a new string containing only the parentheses and their...

0 / 50

Given a string and a non-empty substring `sub`, compute recursively if at least `n` copies of `sub` appear in the string somewhere, possibly...

0 / 50

Given a string `str` and a non-empty substring `sub`, compute recursively the largest substring which both starts and ends with `sub` and...

0 / 50

Given a string, return `true` if it is a nesting of zero or more pairs of parentheses, like "(())" or "((()))". Suggestion: check the first...

0 / 50

Given a string, compute recursively (no loops) the number of times lowercase "hi" appears in the string.

0 / 50

Count recursively (no loops) the total number of "abc" and "aba" substrings that appear in the given string.

0 / 50

Given a string, compute recursively (no loops) a new string where all the lowercase 'x' chars have been changed to 'y' chars.

0 / 50

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...

0 / 50

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...

0 / 50

Given a string, return a recursively "cleaned" string where adjacent chars that are the same have been reduced to a single char. So...

0 / 50

Given an array of `int`s, compute recursively if the array contains somewhere a value followed immediately by that same value times 10....

0 / 50

Given a string, compute recursively a new string where all the 'x' chars have been removed.

0 / 50

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...

0 / 50

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 (...

0 / 50

Given a string, compute recursively (no loops) a new string where all appearances of "pi" have been replaced by "3.14".

0 / 50

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...