Regarding reversing stack

we can also use swap function right??

hello @adarshsingh2k where do you want to use swap function when we are transferring elements from stack1 to stack2?
if you are thinking this way then you are wrong because you need to remove top elements and add also .
so swap will not work .

reverse stack element using recurssion

no to use it in same stack and swap elemnts

1 Like

@adarshsingh2k you cannot do in that way.
You have to use two stacks using recursion and you will be able to solve for the same .

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.