bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
MediumTreesLC 230

Kth Smallest Element In a Bst

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.

Asked at 13 companies
AffirmAmazonApple
Hints
  • 1.Think about what data structure fits Kth Smallest Element In a Bst
  • 2.Consider the brute force complexity and how to optimize
  • 3.Can you trade space for time?
LeetCodeNeetCode