# About the rotation matrix on leetcode!

2022-02-03 00:55:34

###### I can't figure out what went wrong
``class Solution:    def rotate(self, matrix: List[List[int]]) -> None:        """        Do not return anything, modify matrix in-place instead.        """        j=i=0        matrix_1=matrix        n=len(matrix)        while i<n:            while j<n:                (matrix_1[i])[j]=(matrix[j])[n-i-1]                j+=1            i+=1                matrix=matrix_1``

![img]( Operation results and error reporting contents https://img-mid.csdnimg.cn/release/static/image/mid/ask/285663747936172.png "#left")

###### What I want to achieve

Refer to the answer 1：

I uploaded the wrong code I'll upload it again

``class Solution:    def rotate(self, matrix: List[List[int]]) -> None:        """ Do not return anything, modify matrix in-place instead. """        j=i=0        matrix_1=matrix        n=len(matrix)        while i<n:            while j<n:                (matrix_1[i])[j]=(matrix[n-1-j])[i]                j+=1            j=0            i+=1                matrix=matrix_1``

Refer to the answer 2：