One logical line python solution. Rotate in place.

  • 0

    Rotating from outermost square to innermost square. Rotating one square per outer iteration.

        def rotate(self, matrix):
            :type matrix: List[List[int]]
            :rtype: void Do not return anything, modify matrix in-place instead.
            print matrix
            for i in range(len(matrix)):
                for j in range(i,len(matrix)-i-1):

Log in to reply

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