feat(content): function signatures + test cases
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user