When the stack falls,then, we are pushing the item into the helper stack. How is the helper storing all the previous pushed elements ? (Because stack is local for each recursive call, then the helper stack would be deleted)
Reverse a stack
Hi @yashomar95,
They are not local as we are not creating them in the function, we are passing the reference so they are the same stack and helper stack.
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.