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

@@ -10,6 +10,32 @@ patterns:
- dfs
- tree-traversal
function_signature: "def find_tilt(root: TreeNode) -> int:"
test_cases:
visible:
- input: { root: [1, 2, 3] }
expected: 1
- input: { root: [4, 2, 9, 3, 5, null, 7] }
expected: 15
- input: { root: [21, 7, 14, 1, 1, 2, 2, 3, 3] }
expected: 9
hidden:
- input: { root: [] }
expected: 0
- input: { root: [1] }
expected: 0
- input: { root: [1, 2, null] }
expected: 2
- input: { root: [1, null, 3] }
expected: 3
- input: { root: [0, 0, 0] }
expected: 0
- input: { root: [5, 5, 5, 5, 5, 5, 5] }
expected: 0
- input: { root: [1, 2, 3, 4, null, 5, 6] }
expected: 11
description: |
Given the `root` of a binary tree, return *the sum of every tree node's **tilt***.