2dbi
Home/Asana/Kth Smallest Element in a BST
AAsana·DSASDE-2Technical Phone Screen

Kth Smallest Element in a BST

Problem

Return the kth smallest value in a binary search tree.

Example

in-order traversal -> kth visited

Constraints

  • 1 ≤ k ≤ nodes

Approach

In-order traversal (iterative) stopping at k. Reported Asana question.

added 6 days ago
LeadersAccount