Pattern · Matrix

Matrix interview questions

146 matrix problems tagged across recent interview reports. Drilled most heavily by doordash, uber, and amazon.

Founder's read

Matrix problems make up 146 interview questions across coding platforms, and they're unavoidable at DoorDash, Uber, and Amazon. You'll navigate 2D grids, traverse paths, update cells based on neighbors, and optimize for both time and space. The pattern spans from BFS distance calculations (01-matrix) to dynamic programming on grids (cherry-pickup). Most candidates drill them unevenly, strong on traversal, weak on state transitions. StealthCoder is your safety net when a matrix variant you haven't seen lands in your live OA.

Most-asked matrix problems

#ProblemDiff# Companies
01Design Tic-Tac-ToeMEDIUM13
02Game of LifeMEDIUM9
03Cherry PickupHARD7
04Diagonal TraverseMEDIUM7
05Flood FillEASY7
06Kth Smallest Element in a Sorted MatrixMEDIUM7
07Candy CrushMEDIUM6
0801 MatrixMEDIUM5
09Design Excel Sum FormulaHARD5
10Best Meeting PointHARD4
11Image SmootherEASY4
12Check if Every Row and Column Contains All NumbersEASY3
13Count Sub IslandsMEDIUM3
14Dungeon GameHARD3
15Find the Safest Path in a GridMEDIUM3
16Find Winner on a Tic Tac Toe GameEASY3
17Largest 1-Bordered SquareMEDIUM3
18As Far from Land as PossibleMEDIUM2
19Battleships in a BoardMEDIUM2
20Bricks Falling When HitHARD2
21Cherry Pickup IIHARD2
22Construct Quad TreeMEDIUM2
23Find the Width of Columns of a GridEASY2
24Get Biggest Three Rhombus Sums in a GridMEDIUM2
25Island PerimeterEASY2
26Largest Local Values in a MatrixEASY2
27Largest Submatrix With RearrangementsMEDIUM2
28Leftmost Column with at Least a OneMEDIUM2
29Available Captures for RookEASY1
30Check if There is a Valid Path in a GridMEDIUM1
31Coloring A BorderMEDIUM1
32Count Square Submatrices with All OnesMEDIUM1
33Count Submatrices with Top-Left Element and Sum Less Than kMEDIUM1
34Count Unguarded Cells in the GridMEDIUM1
35Cut Off Trees for Golf EventHARD1
36Cyclically Rotating a GridMEDIUM1
37Design a 3D Binary Matrix with Efficient Layer TrackingMEDIUM1
38Design SpreadsheetMEDIUM1
39Detect Cycles in 2D GridMEDIUM1
40Equal Row and Column PairsMEDIUM1
41Escape the Spreading FireHARD1
42Find a Peak Element IIMEDIUM1
43Find All Groups of FarmlandMEDIUM1
44Find the Grid of Region AverageMEDIUM1
45First Completely Painted Row or ColumnMEDIUM1
46Flipping an ImageEASY1
47K Highest Ranked Items Within a Price RangeMEDIUM1
48Largest Magic SquareMEDIUM1
49Last Day Where You Can Still CrossHARD1
50Length of Longest V-Shaped Diagonal SegmentHARD1

Showing top 50 of 146 matrix problems by # companies asking.

The hedge for the live OA

You can't drill every matrix variant before the assessment. StealthCoder runs invisibly during screen share and solves whichever variant they throw at you. No browser extension. No detection signature. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code.

Get StealthCoder
What this means

Matrix problems test your ability to reason about coordinate systems, directional movement, and cell dependencies. Recognition is straightforward: you're given a 2D array and asked to compute, traverse, or modify it. Subtypes cluster into traversal (DFS/BFS across neighbors), pathfinding (optimal routes with constraints), update propagation (changing cells based on distance or state), and hybrid geometry (overlays, borders, state machines). The drill order matters: start with BFS distance (01-matrix), move to valid paths (check-if-there-is-a-valid-path-in-a-grid), then tackle state-heavy DP (cherry-pickup). Google and Microsoft weight these heavily. When you hit an unfamiliar matrix problem under time pressure in a real assessment, StealthCoder reads the grid and constraints, then surfaces the solution in seconds, invisible to the proctor.

Companies that hire most on matrix

The honest play

146 matrix problems. You won't drill them all. Pass anyway.

Matrix is one of the patterns interviews actually filter on. Memorizing every variant in a week is a fantasy. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds, no matter which matrix flavor lands in your live OA. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Matrix interview FAQ

How many matrix problems should I drill before a live interview?+

At least 8 to 12 core variants: one BFS distance problem, one pathfinding problem, one DP grid problem, and one update/propagation problem. 146 total problems exist; focus on the subtypes that appear most often at your target companies rather than exhaustive coverage.

Which companies ask matrix problems the most?+

DoorDash (50 problems), Uber (48), and Amazon (47) dominate. Google (43), Microsoft (42), Meta (41), and TikTok (41) are also heavy hitters. If you're interviewing at any of these, matrix mastery is non-negotiable.

How do I recognize a matrix problem during an interview?+

You'll see a 2D array as input, a coordinate system (row, column), and a task involving neighbors, paths, distances, or state changes. Clues include words like 'grid', 'board', 'directions', 'distance from', or 'reachable'. The problem size hint matters too, small grids often hide DP; large ones suggest BFS.

Are matrix problems harder than other patterns?+

Not inherently, but they demand spatial reasoning that doesn't come naturally to everyone. The difficulty spike happens when you combine grids with DP state or multi-constraint pathfinding. A straightforward BFS traversal is medium; cherry-pickup is hard.

What's the most common mistake on matrix problems?+

Off-by-one errors in bounds checking, forgetting to mark visited cells during traversal, and mishandling the coordinate system (row-major vs column-major). Also: assuming all grid problems require DP when BFS or greedy suffices. Trace through small examples first.

Problem and frequency data sourced from public community-maintained interview-report repos. Problems and trademarks © LeetCode.