feat(content): function signatures + test cases
This commit is contained in:
@@ -10,6 +10,30 @@ patterns:
|
||||
- dfs
|
||||
- tree-traversal
|
||||
|
||||
function_signature: "def right_side_view(root: TreeNode) -> list[int]:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { root: [1, 2, 3, null, 5, null, 4] }
|
||||
expected: [1, 3, 4]
|
||||
- input: { root: [1, 2, 3, 4, null, null, null, 5] }
|
||||
expected: [1, 3, 4, 5]
|
||||
- input: { root: [1, null, 3] }
|
||||
expected: [1, 3]
|
||||
hidden:
|
||||
- input: { root: [] }
|
||||
expected: []
|
||||
- input: { root: [1] }
|
||||
expected: [1]
|
||||
- input: { root: [1, 2, null] }
|
||||
expected: [1, 2]
|
||||
- input: { root: [1, 2, 3, 4, 5, 6, 7] }
|
||||
expected: [1, 3, 7]
|
||||
- input: { root: [1, 2, null, 3, null, 4, null, 5] }
|
||||
expected: [1, 2, 3, 4, 5]
|
||||
- input: { root: [0, -1, 100] }
|
||||
expected: [0, 100]
|
||||
|
||||
description: |
|
||||
Given the `root` of a binary tree, imagine yourself standing on the **right side** of it, return *the values of the nodes you can see ordered from top to bottom*.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user