feat(content): more test cases

This commit is contained in:
2025-07-13 19:25:39 +01:00
parent e28da5def2
commit 0f264ef603
94 changed files with 1840 additions and 0 deletions

View File

@@ -10,6 +10,24 @@ patterns:
- dfs
- tree-traversal
function_signature: "def kth_smallest(root: TreeNode | None, k: int) -> int:"
test_cases:
visible:
- input: { root: [3, 1, 4, null, 2], k: 1 }
expected: 1
- input: { root: [5, 3, 6, 2, 4, null, null, 1], k: 3 }
expected: 3
- input: { root: [1], k: 1 }
expected: 1
hidden:
- input: { root: [2, 1, 3], k: 2 }
expected: 2
- input: { root: [5, 3, 6, 2, 4, null, null, 1], k: 6 }
expected: 6
- input: { root: [3, 1, 4, null, 2], k: 4 }
expected: 4
description: |
Given the `root` of a binary search tree, and an integer `k`, return the `k`<sup>th</sup> smallest value (**1-indexed**) of all the values of the nodes in the tree.