30. Closest Neighbour in BST
β GFG solution to the Closest Neighbour in BST problem: find the greatest value β€ k using BST properties. π
π§© Problem Description
π Examples
Example 1
Input: root = [10,7,15,2,8,11,16], k = 14Output: 11
Explanation: The greatest element β€ 14 is 11.
Example 2
Input: root = [5,2,12,1,3,9,21,null,null,null,null,null,null,19,25], k = 24Example 3
π Constraints
β
My Approach
Iterative BST Floor Search
π Expected Time and Auxiliary Space Complexity
π§βπ» Code (C++)
π§βπ» Code (Java)
π Code (Python)
π§ Contribution and Support
πVisitor Count
Last updated