Comprehensible python solution

  • 2
    class Solution(object):
        def rotate(self, matrix):
            :type matrix: List[List[int]]
            :rtype: void Do not return anything, modify matrix in-place instead.
            n = len(matrix)
            for i in xrange(n):
                for j in xrange(n):
                    if i < j:
                        matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j]
            for l in matrix:

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.