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
- AlgorithmsCoding exercise
Matrix Rotation
MEDIUMRotate an n×n matrix 90 degrees clockwise and return the result as a new array.
25 minAmazon · Apple · MicrosoftPractice - AlgorithmsCoding exercise
Maximal Square
MEDIUMFind 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 minPremium questionPractice - AlgorithmsCoding exercise
Minimum Path Sum
MEDIUMFind 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 minPremium questionPractice - AlgorithmsCoding exercise
Search a 2D Matrix
MEDIUMSearch 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 minPremium questionPractice - AlgorithmsCoding exercise
N-Queens
HARDPlace 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 minPremium questionPractice - AlgorithmsCoding exercise
Sudoku Solver
HARDFill 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 minPremium questionPractice