Pattern Recognition Drill
Easy Arrays & Strings
The Problem
Given an array a, reverse it in-place.
What approach would you use?
Think about it before scrolling down.
Swap elements at left and right pointers, converge toward center. O(n) time, O(1) space.
Push all → pop all gives reversed order, but uses O(n) space — violates in-place requirement.
Common Trap
Don't reach for slicing (a[::-1]) in an interview — it creates a new array, not in-place.