I have implemeted the code for this question…
It is showing wrong answer for all test cases, although it is showing right output for given input.
My logic is –
After building the tree.
I have checked from root node if this is bst then update the mass value.
i have also checked in the left and right side of root,
Showing wrong answer
Have you considered that approach ?
YES… I was doing that mistake…
Now it got accepted i have calculated the number of nodes.
So now is it working fine? If not then please share your updated code after doing this correction.
1 Like
Yaa… It is working fine Now…
Cool, if you like my explanation do give it a like