feat(content): function signatures + test cases
This commit is contained in:
@@ -9,6 +9,30 @@ patterns:
|
||||
- bfs
|
||||
- tree-traversal
|
||||
|
||||
function_signature: "def is_complete_tree(root: TreeNode) -> bool:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { root: [1, 2, 3, 4, 5, 6] }
|
||||
expected: true
|
||||
- input: { root: [1, 2, 3, 4, 5, null, 7] }
|
||||
expected: false
|
||||
hidden:
|
||||
- input: { root: [1] }
|
||||
expected: true
|
||||
- input: { root: [1, 2] }
|
||||
expected: true
|
||||
- input: { root: [1, null, 2] }
|
||||
expected: false
|
||||
- input: { root: [1, 2, 3, 4, 5, 6, 7] }
|
||||
expected: true
|
||||
- input: { root: [1, 2, 3, 4, null, 6, 7] }
|
||||
expected: false
|
||||
- input: { root: [1, 2, 3, null, null, 6, 7] }
|
||||
expected: false
|
||||
- input: { root: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }
|
||||
expected: true
|
||||
|
||||
description: |
|
||||
Given the `root` of a binary tree, determine if it is a *complete binary tree*.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user