Why is output ot coming right?
@kamya
In this problem , in the particular case when the node to be deleted has two children , you are picking the inorder successor ( min value from right subtree ) as its replacement. However the online judge in this problem expects you to choose inorder predecessor ( max value from left subtree ) as its replacement. While both are suitable candidates for being the replacements , it depends from problem to problem which they ask. Make the according changes and let me know if you need any help with it.
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.