How to do this question without using extra stack . Instead of stack can we take help of an array to reverse the stack?
Doubt regarding Reversing a stack problem
@Lalit2142,
2 methods.
- Use recursion and hold the popped elements in the function.
- Implement a stack using linked list and reverse a stack like you would reverse a linked list.