feat(content): function signatures + test cases
This commit is contained in:
@@ -10,6 +10,24 @@ patterns:
|
||||
- dfs
|
||||
- backtracking
|
||||
|
||||
function_signature: "def all_paths_source_target(graph: list[list[int]]) -> list[list[int]]:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { graph: [[1, 2], [3], [3], []] }
|
||||
expected: [[0, 1, 3], [0, 2, 3]]
|
||||
- input: { graph: [[4, 3, 1], [3, 2, 4], [3], [4], []] }
|
||||
expected: [[0, 4], [0, 3, 4], [0, 1, 3, 4], [0, 1, 2, 3, 4], [0, 1, 4]]
|
||||
hidden:
|
||||
- input: { graph: [[1], []] }
|
||||
expected: [[0, 1]]
|
||||
- input: { graph: [[1, 2, 3], [4], [4], [4], []] }
|
||||
expected: [[0, 1, 4], [0, 2, 4], [0, 3, 4]]
|
||||
- input: { graph: [[2, 1], [2], []] }
|
||||
expected: [[0, 2], [0, 1, 2]]
|
||||
- input: { graph: [[1, 3], [2], [3], []] }
|
||||
expected: [[0, 1, 2, 3], [0, 3]]
|
||||
|
||||
description: |
|
||||
Given a directed acyclic graph (**DAG**) of `n` nodes labeled from `0` to `n - 1`, find all possible paths from node `0` to node `n - 1` and return them in **any order**.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user