Rotate Image
MediumArrays & Hashing
Decode it first. Clues, constraints, pattern and plan before any code.You are given an n x n matrix representing an image. Rotate it 90 degrees clockwise, in place: change matrix directly instead of building a new one.
[[1, 2, 3], [[7, 4, 1],
[4, 5, 6], → [8, 5, 2],
[7, 8, 9]] [9, 6, 3]]The function returns nothing; the tests inspect matrix after the call.
Constraints
n == matrix.length == matrix[i].length1 <= n <= 20-1000 <= matrix[i][j] <= 1000