What is the issue with my code?

Only one output is obtained https://ide.codingblocks.com/s/213283

@tusharnitharwal if you draw the tree, you will see that only 5 violates the conditions you are checking, the subtree with 6 is a perfectly fine BST. https://ide.codingblocks.com/s/213463 here, i have made some changes to your code try this.

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.