feat(content): function signatures + test cases

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

View File

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