What does this print for n=4?
<code>void p(int n) { if (n == 0) return; p(n - 1); System.out.print(n); } </code></pre>
- A
4321
- Bcheck_circle
1234
- C
4
- D
0
Explanation
Recurse first (depths to base), then print on the way back up: 1, 2, 3, 4.
AP Computer Science A· difficulty 4/5
What does this print for n=4?
<code>void p(int n) { if (n == 0) return; p(n - 1); System.out.print(n); } </code></pre>
4321
1234
4
0
Explanation
Recurse first (depths to base), then print on the way back up: 1, 2, 3, 4.
Want 10 more like this — adaptive to your weak spots?