Not getting the correct answer

1 3 6 should be printed I am getting 1 3 6 2 5 4

Hey @akash_281 ,
You were not passing the maxLevel value as reference, you are just passing it as value , so the maxLevel is changing for different function stack who have created their own copies of maxLevel .
Which is what we don’t want we just want one copy of maxlevel and every function stack should use that copy only .
I have corrected the code and added comments


Hope it helps !
Happy coding