Skip to content
core-pattern

Matrices & Grid Transformations

Manipulate 2D grids with rotations, traversals, markings, layers, and in-place transformations.

Problems

Problems in Matrices & Grid Transformations

Practice problems that share this primary solution pattern and compare the clues that reveal it.

From above of green leaves on thin branches of plant growing in botanical garden
intermediate
10 min read

Rotate Image

The hard part of rotating a matrix is not visualizing the turn. It is moving every value without destroying one that has not moved yet.

View solution
Close-up of a tablet displaying analytics charts on a wooden office desk, alongside a smartphone and coffee cup.
intermediate
12 min read

Set Matrix Zeroes

The dangerous part is not writing zeroes. It is remembering which zeroes were causes and which zeroes were created by your own writes.

View solution
Vibrant close-up of network cable connectors with colorful lighting.
intermediate
10 min read

Spiral Matrix

A spiral traversal can look correct on a square matrix and still fail immediately on a single row or column. The reliable model is a shrinking rectangle:…

View solution
Detailed view of a circular saw blade in an industrial workshop, showcasing precision and craftsmanship.
intermediate
8 min read

Spiral Matrix II

The key distinction is simple: Spiral Matrix reads values from an existing grid; Spiral Matrix II constructs the grid while the spiral advances. The…

View solution