VERTICAL ORDER PROBLEM


whats wrong in my code?

Hello @samardeep what is the problem that you are facing?

I guess they are showing the wrong output. input : 4 1 2 3 4 5 6 7 -1 -1 -1 -1 -1 8 -1 9 -1 -1 -1 -1 output: 4 2 1 5 6 3 8 7 9 and its wrong in input 4 is two times while in output just once

@samardeep could you please explain the logic you are using?
you are not even forming the tree there must be some another trick which you are using.
please explain that.

i formed the tree https://ide.codingblocks.com/s/436650

this is your corrected code and i have commented the mistake:

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.