feat(content): function signatures + test cases

This commit is contained in:
2025-07-13 19:53:34 +01:00
parent 9e6c6d256f
commit 65a8d525f5
203 changed files with 4526 additions and 0 deletions

View File

@@ -10,6 +10,26 @@ patterns:
- bfs
- tree-traversal
function_signature: "def level_order_bottom(root: TreeNode) -> list[list[int]]:"
test_cases:
visible:
- input: { root: [3, 9, 20, null, null, 15, 7] }
expected: [[15, 7], [9, 20], [3]]
- input: { root: [1] }
expected: [[1]]
- input: { root: [] }
expected: []
hidden:
- input: { root: [1, 2, 3, 4, 5, 6, 7] }
expected: [[4, 5, 6, 7], [2, 3], [1]]
- input: { root: [1, 2, null, 3, null, 4] }
expected: [[4], [3], [2], [1]]
- input: { root: [1, null, 2, null, 3] }
expected: [[3], [2], [1]]
- input: { root: [-10, 9, 20, null, null, 15, 7] }
expected: [[15, 7], [9, 20], [-10]]
description: |
Given the `root` of a binary tree, return *the bottom-up level order traversal of its nodes' values* (i.e., from left to right, level by level from leaf to root).