Problem : https://leetcode.com/problems/minimum-absolute-difference-in-bst/
My Solution : https://ide.codingblocks.com/s/294872
Please explain why I am getting wrong answer ?
Problem : https://leetcode.com/problems/minimum-absolute-difference-in-bst/
My Solution : https://ide.codingblocks.com/s/294872
Please explain why I am getting wrong answer ?
hello @vaishnavtannu
ur logic is not correct.
if we r at current node then u need to take its difference with largest node in its left subtree (inorder predecessor) which may or may not be immediate left node of the current node.
do inorder traversal and compute difference of current node with last encounter node. and update ur overall minimu
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.