Recursive Method Return Value
Consider the following recursive method.
public static int mystery(int x)
{
if (x == 0) {
return 0;
} else {
return (x + mystery(x / 2) + mystery(x / 4));
}
}
What value is returned by the call mystery(10)?
A
12
B
20
C
10
D
22
Question Leaderboard
Not enough data yet to show leaderboard.
