Reachable Nodes in a Directed Graph

Problem: Reachable Nodes in a Directed Graph

Given a directed graph and a starting node start, return all nodes that are reachable from start.

The graph may contain cycles, for example:

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: