https://leetcode.com/problems/rotate-image

You are given an nxn 2D matrix representing an image.

Rotate the image by 90 degrees (clockwise).

Follow up:
Could you do this in-place?

如图所示,我们需要把图上四个点顺时针移动

u: matrix[i][j]

r: matrix[j][n- i]

d:matrix[n - i][n - j]

l: matrix[n - j][i]

**// n should be length - 1 in code

method2:

in discuss, they are using geometry, swap up to down, then swap symmetrically

follow up: how to do like rotate one/more steps ??

results matching ""

    No results matching ""