DSA · Reimagined
Arrays easy time O(n) space O(1)

Reverse an Array

Swap the first and last, then the second and second-last, closing in until the pointers meet. In-place, no extra memory.

3
0
8
1
1
2
6
3
9
4
4
5
7
6

Reverse in place: two pointers start at the ends and move toward each other.

1 / 10

Practice

Machine twin: /dsa-viz-v2/array-reverse.json — the full deterministic run as structured data.