Welcome to the daily solving of our PROBLEM OF THE DAY with Yash Dwivedi. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of BST but also build up problem-solving skills.
In this problem, we are the root of a binary search tree and a number n, find the greatest number in the binary search tree that is less than or equal to n.
Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/closest-neighbor-in-bst/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-cpp14-compiler/6b207e44-b2f7-4ce0-bc9e-2d2639e32e5c