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,...
Recursion Exercises
Score: 0 / 12.0
Exercises
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...
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...
Given a string, compute recursively a new string where all the adjacent chars are now separated by a "*". So given "hello", return...
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 an array of ints, compute recursively if the array contains somewhere a value followed immediately by that same value times 10....
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 (...
Write the missing base case for function largest. Function largest should find the largest number in array numbers. When largest is first...
Write a function in Java that uses recursion (no loops) to check if the String str has any char a. Return true if it does and false if it...
Use the following recursive method:
public int mysteryMethod(int n) { if (n < 0) { return 5; } else { return mysteryMethod(n - 1) +...