Problem
Return the kth smallest value in a binary search tree.
Input / Output
- Input: the root of a BST and an integer k.
- Output: the kth smallest node value (1-indexed).
Constraints
- 1 <= k <= number of nodes; values are distinct.
Example
- BST {3,1,4,null,2}, k = 1 → 1; k = 3 → 3.