feat(content): function signatures + test cases
This commit is contained in:
@@ -11,6 +11,28 @@ patterns:
|
||||
- tree-traversal
|
||||
- dfs
|
||||
|
||||
function_signature: "def inorder_traversal(root: TreeNode) -> list[int]:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { root: [1, null, 2, 3] }
|
||||
expected: [1, 3, 2]
|
||||
- input: { root: [] }
|
||||
expected: []
|
||||
- input: { root: [1] }
|
||||
expected: [1]
|
||||
hidden:
|
||||
- input: { root: [1, 2, 3, 4, 5, null, 8, null, null, 6, 7, 9] }
|
||||
expected: [4, 2, 6, 5, 7, 1, 3, 9, 8]
|
||||
- input: { root: [1, 2, null, 3, null, 4] }
|
||||
expected: [4, 3, 2, 1]
|
||||
- input: { root: [1, null, 2, null, 3, null, 4] }
|
||||
expected: [1, 2, 3, 4]
|
||||
- input: { root: [5, 3, 7, 2, 4, 6, 8] }
|
||||
expected: [2, 3, 4, 5, 6, 7, 8]
|
||||
- input: { root: [-1, -2, -3] }
|
||||
expected: [-2, -1, -3]
|
||||
|
||||
description: |
|
||||
Given the `root` of a binary tree, return *the inorder traversal of its nodes' values*.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user