feat(content): function signatures + test cases
This commit is contained in:
@@ -9,6 +9,30 @@ patterns:
|
||||
- dfs
|
||||
- tree-traversal
|
||||
|
||||
function_signature: "def good_nodes(root: TreeNode) -> int:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { root: [3, 1, 4, 3, null, 1, 5] }
|
||||
expected: 4
|
||||
- input: { root: [3, 3, null, 4, 2] }
|
||||
expected: 3
|
||||
- input: { root: [1] }
|
||||
expected: 1
|
||||
hidden:
|
||||
- input: { root: [2, 2, 2] }
|
||||
expected: 3
|
||||
- input: { root: [5, 4, 3, 2, 1] }
|
||||
expected: 1
|
||||
- input: { root: [1, 2, 3, 4, 5, 6, 7] }
|
||||
expected: 7
|
||||
- input: { root: [-1, -2, -3, -4, -5] }
|
||||
expected: 1
|
||||
- input: { root: [10, 5, 15, 3, 7, 12, 20] }
|
||||
expected: 4
|
||||
- input: { root: [9, 3, 10, null, 6, 9, 14, 4, 8] }
|
||||
expected: 4
|
||||
|
||||
description: |
|
||||
Given a binary tree `root`, a node *X* in the tree is named **good** if in the path from root to *X* there are no nodes with a value *greater than* X.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user