Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2476. Closest Nodes Queries in a Binary Search Tree
For each query value, return the floor (largest value ≤ query) and ceil (smallest value ≥ query) that exist in the given binary search tree, using -1 when no such value exists. With up to 1e5 nodes/queries, solve efficiently by exploiting BST order (per-query traversal) or by inorder-sorting the tree and binary searching the array.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.