feat(content): function signatures + test cases
This commit is contained in:
@@ -12,6 +12,24 @@ patterns:
|
||||
- backtracking
|
||||
- tree-traversal
|
||||
|
||||
function_signature: "def binary_tree_paths(root: TreeNode) -> list[str]:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { root: [1, 2, 3, null, 5] }
|
||||
expected: ["1->2->5", "1->3"]
|
||||
- input: { root: [1] }
|
||||
expected: ["1"]
|
||||
hidden:
|
||||
- input: { root: [1, 2, 3] }
|
||||
expected: ["1->2", "1->3"]
|
||||
- input: { root: [1, 2, null, 3, null, 4] }
|
||||
expected: ["1->2->3->4"]
|
||||
- input: { root: [1, 2, 3, 4, 5, 6, 7] }
|
||||
expected: ["1->2->4", "1->2->5", "1->3->6", "1->3->7"]
|
||||
- input: { root: [-1, -2, -3] }
|
||||
expected: ["-1->-2", "-1->-3"]
|
||||
|
||||
description: |
|
||||
Given the `root` of a binary tree, return *all root-to-leaf paths in **any order***.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user