My sample output and 5 tescases are correct and I’m unable to find the error in code : https://ide.codingblocks.com/s/655811
1 testcase is not passing
Can you tell what’s wrong in my code? since I have used a different logic to the one you shared. Its just 1 testcase that’s coming out wrong.
ur code is failing on this test cases-> 20 8 22 5 3 4 25 -1 -1 10 14 -1 -1 -1 -1 -1 -1 -1 -1
expected o/p --> 5 10 4 14 25
ur o/p --> 5 10 4 22 25
now make a tree and try to find the ans… u will understand that ur ans is not correct and hence would have to modify ur approach…
I drew the tree and did a dry run for vertical print. The run output was coming out different from that. Please dry run it and check the code. Here’s the tree: https://imgur.com/a/0Hlya71
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.