Quick Quiz on Recursion with Strings!
This quiz will test your understanding of recursion with strings.
We'll cover the following...
We'll cover the following...
Technical Quiz
1.
The task is to reverse the string provided.
public static String reverseString(String myStr) {
// Base case
if (myStr.isEmpty()) {
return myStr;
}
// Recursive case
else {
return reverseString(myStr.substring(1)) + myStr.charAt(0);
}
}
What should the base case of the above mentioned code be?
A.
myStr == null
B.
myStr.isEmpty()
C.
myStr.length < 1
1 / 2
Now that we have ...