LeetCodechevron_rightCategorieschevron_rightmatrix
dashboard

matrix

221 problems
Easy: 37Medium: 125Hard: 59

matrix is one of the most repeated interview dimensions. Start with edge-safe fundamentals, then move into pattern-level trade-offs.

Interview Signal

Frequently tests problem modeling, edge handling, and verbal clarity.

Common Pitfall

Template-only answers break under follow-up questioning.

Practice Strategy

Practice in 3-5 problem rounds and always review complexity alternatives.

Recommended Progression

Problem bank

matrix problem bank

Start with a compact scan-friendly list and progressively load more so the topic page stays readable even when the corpus is large.

Progressive topic library

Built for large topic sets: scan the structure first, then go deeper.

hourglass_bottomScroll to continue
search
tuneDifficulty

Showing 24 / 221 problems

+24 per load
#TitleDifficulty
36

Valid Sudoku

Check if a 9x9 Sudoku board is valid by scanning rows, columns, and sub-boxes with hash lookups, ensuring no duplicates …

Medium
37

Sudoku Solver

Solve the Sudoku puzzle by filling empty cells while respecting Sudoku's rules using array scanning and backtracking.

Hard
48

Rotate Image

Rotate an n x n matrix 90 degrees clockwise in-place using array manipulation and mathematical indexing techniques effic…

Medium
54

Spiral Matrix

Given an m x n matrix, return all elements in spiral order starting from the top-left corner.

Medium
59

Spiral Matrix II

Generate a spiral matrix of size n x n, filled with elements from 1 to n² in spiral order, for interview-focused solving…

Medium
63

Unique Paths II

Calculate the number of unique paths from top-left to bottom-right in a grid with obstacles using dynamic programming st…

Medium
64

Minimum Path Sum

Compute the minimum sum from top-left to bottom-right in a grid using state transition dynamic programming efficiently.

Medium
73

Set Matrix Zeroes

Modify the matrix in place by setting rows and columns to zero when an element is zero.

Medium
74

Search a 2D Matrix

Search a 2D matrix efficiently using binary search over its linearized index, ensuring correctness in row-major sorted a…

Medium
79

Word Search

Solve Word Search with backtracking by exploring adjacent cells to match a target word in a grid.

Medium
85

Maximal Rectangle

Compute the largest rectangle of 1's in a binary matrix using dynamic programming and stack-based state transitions effi…

Hard
130

Surrounded Regions

Transform the matrix in-place by marking regions surrounded by 'X' as 'X', while keeping border-adjacent 'O's intact.

Medium
174

Dungeon Game

Calculate the minimum initial health the knight needs to survive the dungeon using state transition dynamic programming …

Hard
200

Number of Islands

Count the number of distinct islands in a binary grid using array traversal combined with depth-first search exploration…

Medium
212

Word Search II

Solve the Word Search II problem using backtracking with pruning to find all words on a board of characters.

Hard
221

Maximal Square

Maximal Square is a matrix-based dynamic programming problem that focuses on finding the largest square filled with 1's.

Medium
240

Search a 2D Matrix II

Efficiently search for a target in a 2D matrix using binary search and matrix properties.

Medium
289

Game of Life

Solve the Game of Life by updating each cell based on its eight neighbors using Array and Matrix simulation patterns eff…

Medium
304

Range Sum Query 2D - Immutable

Design a 2D matrix class that efficiently handles sum queries with O(1) time complexity using a prefix sum approach.

Medium
329

Longest Increasing Path in a Matrix

Find the length of the longest increasing path in a matrix with given movement constraints using graph techniques.

Hard
363

Max Sum of Rectangle No Larger Than K

Solve the "Max Sum of Rectangle No Larger Than K" problem using binary search over the valid sum space to optimize space…

Hard
378

Kth Smallest Element in a Sorted Matrix

Find the kth smallest element in a sorted n x n matrix using efficient binary search or heap strategies for optimized me…

Medium
407

Trapping Rain Water II

Solve Trapping Rain Water II using breadth-first search and priority queues for efficient water trapping in a matrix.

Hard
417

Pacific Atlantic Water Flow

Find all cells on an island where water can flow to both the Pacific and Atlantic oceans using DFS or BFS.

Medium

swap_vertScroll inside the bank to auto-load more

Related Patterns

Matrix LeetCode Problems: 221 Solutions