ByteByteGo logo
menuProblems List

Kth Smallest Number in a Binary Search Tree

Medium

Given the root of a binary search tree (BST) and an integer k, find the kth smallest node value.

Example:

Output: 6

Constraints:

  • n ≥ 1, where n denotes the number of nodes in the tree.
  • 1 ≤ k ≤ n

You can practice coding exercises online by logging into bytebytego.com on your laptop.