feat(content): function signatures + test cases
This commit is contained in:
@@ -10,6 +10,30 @@ patterns:
|
||||
- dfs
|
||||
- tree-traversal
|
||||
|
||||
function_signature: "def prune_tree(root: TreeNode) -> TreeNode:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { root: [1, null, 0, 0, 1] }
|
||||
expected: [1, null, 0, null, 1]
|
||||
- input: { root: [1, 0, 1, 0, 0, 0, 1] }
|
||||
expected: [1, null, 1, null, 1]
|
||||
- input: { root: [1, 1, 0, 1, 1, 0, 1, 0] }
|
||||
expected: [1, 1, 0, 1, 1, null, 1]
|
||||
hidden:
|
||||
- input: { root: [1] }
|
||||
expected: [1]
|
||||
- input: { root: [0] }
|
||||
expected: null
|
||||
- input: { root: [0, 0, 0] }
|
||||
expected: null
|
||||
- input: { root: [1, 1, 1, 1, 1, 1, 1] }
|
||||
expected: [1, 1, 1, 1, 1, 1, 1]
|
||||
- input: { root: [0, 0, 0, 1] }
|
||||
expected: [0, 0, null, 1]
|
||||
- input: { root: [1, 0, 0, 0, 0, 0, 1] }
|
||||
expected: [1, null, 0, null, 1]
|
||||
|
||||
description: |
|
||||
Given the `root` of a binary tree, return *the same tree where every subtree (of the given tree) not containing a* `1` *has been removed*.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user