Recursive Method Execution Trace
Consider the following recursive method.
public static void coconut(int n) {
if (n > 0) {
coconut(n - 1);
System.out.print(n);
coconut(n - 2);
}
}
What is the output when the method call coconut(5) is executed?
A
5432132121
B
123141251231
C
1234123121
D
4321321
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE