feat(content): more test cases
This commit is contained in:
@@ -10,6 +10,24 @@ patterns:
|
||||
- bfs
|
||||
- tree-traversal
|
||||
|
||||
function_signature: "def level_order(root: TreeNode | None) -> list[list[int]]:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { root: [3, 9, 20, null, null, 15, 7] }
|
||||
expected: [[3], [9, 20], [15, 7]]
|
||||
- input: { root: [1] }
|
||||
expected: [[1]]
|
||||
- input: { root: [] }
|
||||
expected: []
|
||||
hidden:
|
||||
- input: { root: [1, 2, 3, 4, 5] }
|
||||
expected: [[1], [2, 3], [4, 5]]
|
||||
- input: { root: [1, 2, null, 3] }
|
||||
expected: [[1], [2], [3]]
|
||||
- input: { root: [1, null, 2, null, 3] }
|
||||
expected: [[1], [2], [3]]
|
||||
|
||||
description: |
|
||||
Given the `root` of a binary tree, return *the level order traversal of its nodes' values*. (i.e., from left to right, level by level).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user