7. DFS Traversal of Graph
Easy

Problem Statement

Given a connected undirected graph, return the Depth First Traversal of this graph starting from node 0.

Examples

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

Sign in to Run Code and Submit