Cracking the coding interview: Ceil in BST — 2

Input:
5
/ \
1 7
\
2
\
3
X = 3
Output: 3
Explanation:
We find 3 in BST, so ceil
of 3 is 3.
Input:
10
/ \
5 11
/ \
4 7
\
8
X = 6
Output: 7
Explanation:
We find 7 in BST, so ceil
of 6 is 7.
Ceil in BST

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store