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

@@ -12,6 +12,24 @@ patterns:
- backtracking
- tree-traversal
function_signature: "def binary_tree_paths(root: TreeNode) -> list[str]:"
test_cases:
visible:
- input: { root: [1, 2, 3, null, 5] }
expected: ["1->2->5", "1->3"]
- input: { root: [1] }
expected: ["1"]
hidden:
- input: { root: [1, 2, 3] }
expected: ["1->2", "1->3"]
- input: { root: [1, 2, null, 3, null, 4] }
expected: ["1->2->3->4"]
- input: { root: [1, 2, 3, 4, 5, 6, 7] }
expected: ["1->2->4", "1->2->5", "1->3->6", "1->3->7"]
- input: { root: [-1, -2, -3] }
expected: ["-1->-2", "-1->-3"]
description: |
Given the `root` of a binary tree, return *all root-to-leaf paths in **any order***.