What is wrong in the code?

@17manishms see you are choosing the current element, and then calling the function, and then not choosing the element, and again calling the function. This has gotten the order all messed up. If you first call the function without choosing the current element, and then call the function after choosing the current element, the order of the output will become fine.


now it is not showing any output

hi @17manishms see this https://ide.codingblocks.com/s/214891
You have to “choose” the element, ie “assign” it to the output element AFTER the first recursive call.

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.