A common method to rotate matrix in Python, but not in-place rotate


  • 0
    S

    clockwise rotate

    zip(*reversed(matrix))
    

    anticlockwise rotate

    zip(* (reversed(row) for row in matrix))
    

    But it's not in-place rotate. Does any one have idea how to make it be in-place rotate?


Log in to reply
 

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