Matrix interview questions
Practice 6 questions on matrix. Each runs in a real in-browser editor with Jest tests and a worked, diagram-backed solution.
6 questions
- MEDIUM
Matrix Rotation
Rotate an n×n matrix 90 degrees clockwise and return the result as a new array.
25 minAlgorithmsAmazon · Microsoft · Apple - MEDIUM
Maximal Square
Find the area of the largest all-ones square in a binary matrix, where each cell's square size is one more than the smallest of its top, left, and top-left neighbors.
25 minAlgorithms - MEDIUM
Minimum Path Sum
Find the cheapest path from the top-left to the bottom-right of a grid, moving only right or down, by summing each cell with the smaller of the two ways to reach it.
25 minAlgorithms - MEDIUM
Search a 2D Matrix
Search a matrix whose rows and columns are both sorted by walking a staircase from the top-right corner, eliminating a whole row or column at each step.
25 minAlgorithms - HARD
N-Queens
PREMIUMPlace N queens on an N×N board so none attack another — a classic backtracking search that places one queen per row and prunes column and diagonal conflicts.
40 minAlgorithms - HARD
Sudoku Solver
PREMIUMFill a 9×9 Sudoku grid by backtracking — try each digit in the next empty cell, checking its row, column, and 3×3 box, and undo on a dead end.
40 minAlgorithms