We use cookies for site analytics. Accept to help us understand how the site is used. See our Privacy Policy for details.
Matrix problems test index discipline more than algorithmic insight: rotating in place, walking a spiral, or using the first row and column as marker storage to hit O(1) space. Many grid problems are really graph problems - islands and flood-fill belong to BFS and DFS - so check which question is actually being asked. Write the index arithmetic out on paper first; it is where the bugs live.
A grid input, spiral or diagonal traversal, or an in-place transformation constraint.
22 problems. Each one runs in an in-browser editor against real test cases, with hints and a worked solution.
The patterns cheat sheet covers all of these in one page - what each one looks like in a problem statement, and the template that follows.