
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Try to utilize the property of a BST.
Try in-order traversal. (Credits to @chan13)
What if you could modify the BST node's structure?
The optimal runtime complexity is O(height of BST).