1. One Coordinate Rule Optimal
Intuition
Write the rule down before writing code: a clockwise quarter turn sends the value at (row, column) to (column, n-1-row). With a fresh grid that is a two-line loop. The in-place version composes two reflections — transpose across the diagonal, then reverse each row — and being able to explain WHY that equals a rotation is what the question is really testing.
Algorithm
1. Allocate an n x n result.
2. For every (r, c), place the original value at (c, n-1-r).
Time & Space
Time O(n^2). Space O(n^2) here; O(1) for the transpose-then-reverse version.