← All problems
Kth Smallest Element in a BST
Given a binary search tree, find the kth smallest value among its nodes. Do better than a full sort; consider what an inorder traversal gives you and how to stop early.
Complexity
Time O(h + k), Space O(h)
Common pitfalls
- Full traversal when early stop suffices
- Off-by-one on k (1-indexed)
Your solution
Log in to save your code and track progress.