Reachable Nodes in a Directed Graph
Asked at SoFi · Coding Questions · Difficulty: Medium · Last asked Jul 4, 2026
Given a directed graph represented by vertices and their neighbor lists, implement `reachableNodes(Vertex start)` to return every vertex reachable from the starting vertex. The follow-up compares DFS and BFS memory behavior, including recursive-stack overflow on a graph with depth around 1,000.
Loading the problem…