Please tell why my code is not passing 2 test cases


please solve the doubt

hello @harryson please wait i am checking your code.

hey @harryson where you are trying to submi this question?

coding blocks i have taken the faang course

actually the same question is there on hackerblocks but i am not able to submit because your way of building the tree is different then the way they are doing.

see for this test case:
your code is producing wrong output.


correct ouput should be 5.

sir can you please debug the code

@harryson you are making the tree in the wrong format we have to prepare the BST.


please see this code
if you have any doubt you can ask here.
Happy Learning!!

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.