AAlgoLoopSpaced repetition for LeetCode

Matrix / Grid

Grid problems treat a 2-D matrix as a graph of cells and apply traversal, search, or DP across the rows and columns. Watch for boundary checks, in-place marking to save space, and the four- versus eight-direction neighbor choice.

8 LeetCode problems solved with the Matrix / Grid pattern. Practice them with spaced repetition so the pattern sticks.

See the full solution

The complete approach, reference solutions in 5 languages, and a step-by-step visualization — then add this problem to your spaced-repetition schedule.

Start free →