Skip to content

Array

How to rotate a 2D array by 90 degrees right or left

Rotate right

  1. Transpose
  2. Reverse each row

rotate left

  1. reverse each row
  2. transpose 3.

Last update: 2022-09-23