Populate next right node. Please Help me solve this leetcode question

My approach:
What is the problem in this approach

@aman212yadav Please help!

@rachitbansal2500
[1,2,3,4,5,6,7]
your output
[1,#,2,#,4,#]
which is wrong

How to correct the code @vatsal38

@rachitbansal2500 use level order print

@vatsal38 can you please correct my code instead? I am doing it in a level order manner only

@rachitbansal2500 but your logic dont seem right dry run your code

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.