Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

class Solution: # @param matrix, a list of lists of integers # @return a list of lists of integers def rotate(self, matrix): return map(lambda x:map(lambda y:y.pop(0),matrix[::-1]),range(len(matrix)))

How about this one liner:

def rotate(self, matrix): return [list(col[::-1]) for col in zip(*matrix)]

I believe I can end "one-line python" topic like this:

zip(*original[::-1]) # or counter-clockwise zip(*original)[::-1]

a bit of cheating, but it works.

matrix[:] = zip(*matrix[::-1])

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