~/boss / crooked-portrait

Rotate a grid in place

The Crooked Portrait

Turn the portrait a quarter clockwise, one tile in your hand at a time.

Loading the fight…

How to beat it

Work ring by ring, from the outside in. Lift a tile from the top edge: it goes to the right edge, the tile it lands on goes to the bottom, that one goes to the left, and the last one drops into the hole you started from. Row r, column c always moves to row c, column n-1-r: the top row becomes the right column.

Now the real boss

Interviews ask for the code. Watch it run, then write it yourself, tested in Python, C++ or Java.

On your phone? Writing code is easier on a laptop: open bossfight.dev/problems/rotate-square-grid-clockwise there. Sign in with your email to keep your progress on every device.

More bosses

esc