Question
Given theÂ
root
 of a binary search tree, and an integerÂk
, return theÂkth
 smallest value (1-indexed) of all the values of the nodes in the tree.
This is atree question.
Idea(s)
- Depth First Search solution
- The key here is to notice that inorder traversal essentially sorts the BST
- Then just return the k-1th element in the result array