Update appNew update is available. Click here to update.
About
C. V. Raman Global University 2022
My Stats
EXP gained
yellow-spark
2766
Level
5 (Champion)
Community stats
Discussions
0
Upvotes
0
Know more
44
Total problems solved
20
Easy
21
Moderate
3
Hard
0
Ninja
Jan Jan Feb Feb Mar Mar Apr Apr May May Jun Jun Jul Jul Aug Aug Sep Sep Oct Oct Nov Nov Dec Dec

Current streak:

0 days

Longest streak:

2 days

Less

More

Discussions
What should be the output for this case?
Interview problems

Can anybody tell me the output for this test case? The console prints nothing. 1 2 -1 3 4 -1 -1 5 6

 

Tree will look like:

         1

       /    

      2

    /    \

   3    4

        /   \

       5   6

 

As per my understanding the output should be: 1 2 3 5 6 4

But as per striver's explanation the output will be: 1 2 3 5 6

 

profile
Praddyumn
Published On 17-Jan-2023
52 views
1 replies
1 upvotes