← All sections

Matrix

2D arrays; your first concrete DFS/backtracking, setting up for graphs.

0/7 lessons · exam: 0/30%

Lessons

  1. ✓01

    Recognizing matrix problems

    Thinking in 2D: (row, column) coordinates, neighbors, bounds, and the O(m·n) complexity.

  2. ✓02

    Pattern 1: Layer-by-layer traversal (spiral)

    Walking the matrix in a spiral by controlling four shrinking bounds.

  3. ✓03

    Pattern 2: In-place transformation

    Rotating the image and zeroing rows/columns without an auxiliary matrix — just index tricks.

  4. ✓04

    Pattern 3: DFS on a grid (flood fill)

    Treating the grid as a graph: flooding connected regions with depth-first search.

  5. ✓05

    Pattern 4: Backtracking on a grid

    Exploring paths by marking and unmarking cells — the word search.

  6. ✓06

    Pattern 5: BFS on a grid (shortest path)

    When the question is 'the shortest', breadth-first search explores layer by layer.

  7. ✓07

    Synthesis: which pattern to use?

    The Matrix section's decision tree and the general quiz before the final exam.

🏁 FINAL EXAM

1 easy + 1 medium + 1 hard — unseen problems

With hidden test cases, just like the real LeetCode. This is where you confirm you can leave the section solving any problem of the topic.