41 BFS shortest path (unweighted) Medium Queue + Visited

Find the fewest edges to get from a starting node to every other node in an unweighted graph.

O(V + E) time · O(V) space
42 DFS iterative Easy Stack + Visited

Walk every reachable node in a graph by going as deep as possible before backtracking, using a stack.

O(V + E) time · O(V) space
43 DFS recursive Easy Visit & Recurse

Walk every reachable node in a graph by going as deep as possible before backtracking, using recursion.

O(V + E) time · O(V) space
44 Detect cycle in undirected graph Medium DFS + Parent

Determine whether an undirected graph contains any loop.

O(V + E) time · O(V) space
45 Count connected components Easy Loop + BFS/DFS

Count how many disconnected groups of nodes exist in a graph.

O(V + E) time · O(V) space
46 Snakes and ladders (BFS) Medium BFS on Board

Find the minimum number of dice rolls to reach square 100 on a snakes-and-ladders board.

O(100) time · O(100) space
144 Rotting Oranges Medium Multi-source BFS

Rotten oranges spread to adjacent fresh oranges each minute. How long until all are rotten?

O(m*n) time · O(m*n) space
145 Surrounded Regions Medium Border DFS

Flip all O regions to X, except those connected to the border of the board.

O(m*n) time · O(m*n) space