feat(content): function signatures + test cases

This commit is contained in:
2025-07-13 19:53:34 +01:00
parent 9e6c6d256f
commit 65a8d525f5
203 changed files with 4526 additions and 0 deletions

View File

@@ -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.