Skip to content
BytePatterns

Matrix & Grid

Rows, columns and neighbours — the grid problems interviews keep drawing.

Matrix & Grid progress0 / 5
  1. Grid TraversalRow first, column second, and always check the edge.4m
  2. Spiral OrderFour walls that close in after every pass.5m
  3. Rotate In PlaceMirror the diagonal, then flip each row.5m
  4. Number of IslandsCount a blob once, then erase it so it cannot count twice.5m
  5. Flood FillSpread while the colour matches, stop the moment it does not.4m

Quiz yourself: 3 questions from this module

1 / 3

Which offset moves one cell up?