Pattern Recognition Drill
Easy Arrays & Strings
The Problem
Given array a and integer k, return the left-rotated array.
What approach would you use?
Think about it before scrolling down.
3-reverse trick: reverse [0:k], reverse [k:n], reverse all. O(n) time, O(1) space.
Slicing a[k:] + a[:k] is clean but creates a new array — fine if in-place isn't required.
Common Trap
Naive shift-one-at-a-time loop is O(n*k) — way too slow for large k.