← All problems
Rotate Image (90 degrees in place)
Rotate an n x n matrix 90 degrees clockwise in place, using O(1) extra space. Find the two-step decomposition that makes this easy.
Complexity
Time O(n^2), Space O(1)
Common pitfalls
- Extra matrix (violates in-place)
- Counterclockwise by mistake
Your solution
Log in to save your code and track progress.