feat(content): function signatures + test cases

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

View File

@@ -11,6 +11,28 @@ patterns:
- dfs
- dynamic-programming
function_signature: "def max_path_sum(root: TreeNode) -> int:"
test_cases:
visible:
- input: { root: [1, 2, 3] }
expected: 6
- input: { root: [-10, 9, 20, null, null, 15, 7] }
expected: 42
hidden:
- input: { root: [1] }
expected: 1
- input: { root: [-3] }
expected: -3
- input: { root: [2, -1] }
expected: 2
- input: { root: [-2, -1] }
expected: -1
- input: { root: [5, 4, 8, 11, null, 13, 4, 7, 2, null, null, null, 1] }
expected: 48
- input: { root: [1, -2, -3, 1, 3, -2, null, -1] }
expected: 3
description: |
A **path** in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear in the sequence **at most once**. Note that the path does not need to pass through the root.