Rotate by 90 Degrees Counter-Clockwise
Given a two-dimensional square matrix
, rotate in-place it 90 degrees counter-clockwise.
Constraints
n = m ≤ 250
wheren
andm
are the number of rows and columns inmatrix
https://binarysearch.com/problems/Rotate-by-90-Degrees-Counter-Clockwise
Examples
Example 1
Input
- matrix =
[[1,2,3],
[4,5,6],
[7,8,9]]
Output
- answer =
[[3, 6, 9], [2, 5, 8], [1, 4, 7]]
Leave a comment