Python code to rotate image


  • 0
    Y

    class Solution(object):
    def rotate(self, matrix):
    return [list(reversed(x)) for x in zip(*matrix)]

    if name=='main':
    matrix=[[1,2,3],[4,5,6],[7,8,9]]
    print Solution().rotate(matrix)


Log in to reply
 

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