feat(content): function signatures + test cases

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

View File

@@ -11,6 +11,26 @@ patterns:
- dfs
- tree-traversal
function_signature: "def postorder_traversal(root: TreeNode) -> list[int]:"
test_cases:
visible:
- input: { root: [1, null, 2, 3] }
expected: [3, 2, 1]
- 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, 6, 7, 5, 2, 9, 8, 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: [5, 3, 7, 2, 4, 6, 8] }
expected: [2, 4, 3, 6, 8, 7, 5]
description: |
Given the `root` of a binary tree, return *the postorder traversal of its nodes' values*.