PROBLEMS/GRAPHS
Graphs LeetCode Problems
202 hand-tagged Graphs problems across 6 interview patterns (BFS Shortest Path (Unweighted), Multi-Source BFS, DFS Connected Components, DFS Path Finding, Union-Find, Topological Sort), ranked by importance (how often each pattern shows up in real coding interviews). Work top-down within each pattern.
| # | PROBLEM | DIFF | ELO | IMP | PATTERNS |
|---|---|---|---|---|---|
| 1 | Nearest Exit from Entrance in Maze | Medium | 1638 | 88 | Matrix Traversal (Diagonal, Valid Sudoku, etc) |
| 2 | Open the Lock | Hard | 1878 | 88 | Frequency Counting / Hash Map Lookup |
| 3 | Shortest Path to Get FoodPREMIUM | Easy | 1350 | 82 | Matrix Traversal (Diagonal, Valid Sudoku, etc) |
| 4 | Word Ladder | Medium | 1637 | 82 | Frequency Counting / Hash Map Lookup |
| 5 | Shortest Path in Binary Matrix | Medium | 1658 | 82 | Matrix Traversal (Diagonal, Valid Sudoku, etc) |
| # | PROBLEM | DIFF | ELO | IMP | PATTERNS |
|---|---|---|---|---|---|
| 1 | Rotting Oranges | Medium | 1433 | 89 | Matrix Traversal (Diagonal, Valid Sudoku, etc) |
| 2 | Walls and GatesPREMIUM | Easy | 1385 | 88 | Matrix Traversal (Diagonal, Valid Sudoku, etc) |
| 3 | 01 Matrix | Medium | 1519 | 82 | Matrix Traversal (Diagonal, Valid Sudoku, etc) |
| 4 | Map of Highest Peak | Medium | 1783 | 82 | |
| 5 | As Far from Land as Possible | Medium | 1666 | 78 | Matrix Traversal (Diagonal, Valid Sudoku, etc) |
| # | PROBLEM | DIFF | ELO | IMP | PATTERNS |
|---|---|---|---|---|---|
| 1 | Number of Islands | Easy | 1323 | 93 | BFS Shortest Path (Unweighted) · Union-Find |
| 2 | Number of Connected Components in an Undirected GraphPREMIUM | Easy | 1303 | 88 | Union-Find |
| 3 | Max Area of Island | Easy | 1280 | 85 | Matrix Traversal (Diagonal, Valid Sudoku, etc) |
| 4 | Number of Provinces | Easy | 1281 | 85 | Union-Find · BFS Shortest Path (Unweighted) |
| 5 | Pacific Atlantic Water Flow | Medium | 1573 | 85 | Multi-Source BFS · Matrix Traversal (Diagonal, Valid Sudoku, etc) |
| # | PROBLEM | DIFF | ELO | IMP | PATTERNS |
|---|---|---|---|---|---|
| 1 | Longest Increasing Path in a Matrix | Hard | 1928 | 88 | Grid Path Problems · Topological Sort |
| 2 | Evaluate Division | Medium | 1597 | 82 | Union-Find · BFS Shortest Path (Unweighted) |
| 3 | Reconstruct Itinerary | Hard | 1857 | 73 | Heap Simulation · Sorting + Comparison |
| 4 | Restore the Array From Adjacent Pairs | Medium | 1579 | 55 | Frequency Counting / Hash Map Lookup |
| 5 | All Paths from Source Lead to DestinationPREMIUM | Medium | 1628 | 52 | Topological Sort |
| # | PROBLEM | DIFF | ELO | IMP | PATTERNS |
|---|---|---|---|---|---|
| 1 | Graph Valid TreePREMIUM | Easy | 1398 | 87 | DFS Connected Components · BFS Shortest Path (Unweighted) |
| 2 | Accounts Merge | Medium | 1638 | 83 | DFS Connected Components · Frequency Counting / Hash Map Lookup |
| 3 | Redundant Connection | Medium | 1420 | 82 | DFS Connected Components |
| 4 | Smallest String With Swaps | Hard | 1855 | 82 | Sorting + Comparison · DFS Connected Components |
| 5 | Number of Islands IIPREMIUM | Hard | 1842 | 78 | Frequency Counting / Hash Map Lookup |
| # | PROBLEM | DIFF | ELO | IMP | PATTERNS |
|---|---|---|---|---|---|
| 1 | Course Schedule | Medium | 1414 | 92 | |
| 2 | Course Schedule II | Medium | 1503 | 90 | |
| 3 | Alien DictionaryPREMIUM | Hard | 1842 | 88 | BFS Shortest Path (Unweighted) · Frequency Counting / Hash Map Lookup |
| 4 | Minimum Height Trees | Medium | 1748 | 82 | BFS Shortest Path (Unweighted) |
| 5 | Build a Matrix With Conditions | Hard | 1961 | 82 | Matrix Traversal (Diagonal, Valid Sudoku, etc) |
EVERY PATTERN
// your mastery





What's your Graphs tier?
leaps.gg syncs your LeetCode history and scores your mastery of every pattern, then recommends the exact problems to do next with spaced repetition. Free to start.
GET MY MASTERY MAP →