I dont know about maps so i have used vectors and done some manipulations
One test case is not getting passed
@tusharnitharwal
your code is giving wrong answer with this test case
Q: 20 8 22 5 3 4 25 -1 -1 10 14 -1 -1 -1 -1 -1 -1 -1 -1
A : 5 10 4 14 25
but the answer should be 5 10 4 22 25 because both 14 and 22 have hd=-1 but 22 lies on the right
@tusharnitharwal
Thats right
But you can assume that if two nodes are at same horizontal depth then you print the one which comes first
thats what i did. 22 lies on the right
still not working. Now only one case gets passed.https://ide.codingblocks.com/s/210557 Actually the question says to print the right one in case of a tie
@tusharnitharwal
I suggest you just print the output if the input is that one weird test case
for the rest use the previous code
I’ll send the info to the team to review the test case
Your code is correct and advise you to move on and not waste time with it anymore
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.