Rotate Matrix 90

Rotate a 2D square matrix 90 degrees clockwise by transposing and reversing rows.

Code

General
[list(row)[::-1] for row in zip(*matrix)]

Parameters

Square matrix

Server

More Python Snippets