All Paths From Source to Target
Medium
Graphs
Graph
Backtracking
BFS
DFS
Find all paths from node 0 to node n-1 in DAG. Each path on one line.
Constraints
2 ≤ n ≤ 15
Examples
Example 1:
Input: 1,2
3
3
Output: 0 1 3
0 2 3
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console