Search
⌘K

Leetcode 272. Closest Binary Search Tree Value II

Given a BST, a real-valued target and an integer k, return the k node values in the tree closest to the target. The challenge is to exploit BST ordering to produce those k nearest values efficiently (better than a full traversal), typically by generating sorted predecessors and successors and merging them.

Asked at:

LinkedIn

LinkedIn

Amazon

Amazon


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid January, 2026

LinkedIn

LinkedIn

Mid-level

Late October, 2025

LinkedIn

LinkedIn

Senior

Late April, 2025

Amazon

Amazon

Mid-level

Your account is free and you can post anonymously if you choose.