Find if Path Exists in Graph
Graphs · BFS · Explore a frontier until you reach the goal · Easy · about 20 min
Why it matters
This is the cleanest bridge from trees to general graphs.
How it connects
Flood fill explored a grid. This uses the same visit rule on an adjacency list.
Try first
First write down what a node’s neighbours look like after you build an adjacency list.
Interview cue
Visited nodes prevent cycles from repeating work; traversal is O(V + E).