Why is my code giving wrong output?
Wrong Output for all the test cases
only one small mistake you have done
you have to push i into stack after while loop
Modified Code
i hope this help
if you have more doubts regarding this feel free to ask
if your doubt is resolved mark it as resolved from your doubt section inside your course
Got it! Thanks for your help.