Kth Smallest Element in a BST

Try to solve the Kth Smallest Element in a BST problem.


Given the root node of a binary search tree and an integer value k, return the kthk^{th} smallest value in the tree.


  • The number of nodes in the tree is nn.
  • 1kn5001 \leq k \leq n \leq 500
  • 00 \leq Node.data 104\leq 10^4

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy