Rotate a Square Matrix In Place

Asked at Uber · Coding Questions · Difficulty: Medium

Rotate a square grid of values a quarter turn clockwise, working inside the grid you were given. Think of an image stored as rows of pixel values: the function turns the picture by 90 degrees without building a second copy of it.

Loading the problem…