PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Uber

Find Kth Smallest in BST

Last updated: Apr 16, 2026

Quick Overview

This question evaluates understanding of binary search tree properties, ordered data retrieval, and algorithmic efficiency in locating the k-th smallest element.

  • medium
  • Uber
  • Coding & Algorithms
  • Software Engineer

Find Kth Smallest in BST

Company: Uber

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given the root of a binary search tree and an integer `k`. Return the value of the node that would appear in the `k`th position if all node values were listed in ascending order. A binary search tree has the property that for every node: - all values in the left subtree are smaller than the node value, and - all values in the right subtree are larger than the node value. You may assume `1 <= k <= number of nodes in the tree`. Example: - Input: root = [5,3,6,2,4,null,null,1], k = 3 - In-order traversal gives: [1,2,3,4,5,6] - Output: 3 Discuss an efficient approach and analyze its time and space complexity.

Quick Answer: This question evaluates understanding of binary search tree properties, ordered data retrieval, and algorithmic efficiency in locating the k-th smallest element.

Related Interview Questions

  • Implement Minesweeper and Word Search - Uber (medium)
  • Implement Store Autocomplete - Uber (medium)
  • Implement Cache Eviction And Seat Assignment - Uber (medium)
  • Schedule Non-Overlapping Meetings Efficiently - Uber (hard)
  • Evaluate an Arithmetic Expression - Uber
Uber logo
Uber
Feb 25, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
1
0

You are given the root of a binary search tree and an integer k. Return the value of the node that would appear in the kth position if all node values were listed in ascending order.

A binary search tree has the property that for every node:

  • all values in the left subtree are smaller than the node value, and
  • all values in the right subtree are larger than the node value.

You may assume 1 <= k <= number of nodes in the tree.

Example:

  • Input: root = [5,3,6,2,4,null,null,1], k = 3
  • In-order traversal gives: [1,2,3,4,5,6]
  • Output: 3

Discuss an efficient approach and analyze its time and space complexity.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Uber•More Software Engineer•Uber Software Engineer•Uber Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.