6. BFS Traversal of Graph
Easy

Problem Statement

Given a directed graph, return the Breadth First Traversal of this graph starting from node 0.

Examples

1Example 1
Input:
[ 5, [ [ 1, 2, 3 ], [], [ 4 ], [], [] ] ]
Output:
[ 0, 1, 2, 3, 4 ]
2Example 2
Input:
[ 4, [ [ 1, 3 ], [ 2 ], [ 0 ], [] ] ]
Output:
[ 0, 1, 3, 2 ]
Loading...

Sign in to Run Code and Submit