To traverse <code>arr</code> from last to first:
- A
for-each
- B
for (int i = arr.length; i > 0; i--)
- Ccheck_circle
for (int i = arr.length - 1; i >= 0; i--)
- D
for (int i = 0; i < arr.length; i++)
Explanation
Indices <code>length-1</code> down to 0.
AP Computer Science A· difficulty 3/5
To traverse <code>arr</code> from last to first:
for-each
for (int i = arr.length; i > 0; i--)
for (int i = arr.length - 1; i >= 0; i--)
for (int i = 0; i < arr.length; i++)
Explanation
Indices <code>length-1</code> down to 0.
Want 10 more like this — adaptive to your weak spots?