Find the k-th smallest value in a binary search tree using an in-order traversal.
Constraints
Example
>>> # Construct BST: root = TreeNode(3, TreeNode(1, None, TreeNode(2)), TreeNode(4)) >>> kth_smallest(root, 1) 1 >>> kth_smallest(root, 2) 2 >>> kth_smallest(root, 3) 3
Recent Submissions
No submissions yet — hit Run Tests to try!
Hints