30:00
You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate the image in-place.
n==matrix.length==matrix[i].lengthn == \text{matrix.length} == \text{matrix}[i].\text{length}n==matrix.length==matrix[i].length
1≤n≤201 \leq n \leq 201≤n≤20
−1000≤matrix[i][j]≤1000-1000 \leq \text{matrix}[i][j] \leq 1000−1000≤matrix[i][j]≤1000
Start
1
2
3
4
5
6
7
8
9