Problem of the day
Reverse a given stack of 'N' integers using recursion. You are required to make changes in the input parameter itself.
Note: You are not allowed to use any extra space other than the internal stack space used due to recursion.
Input: [1,2,3,4,5]
Output: [5,4,3,2,1]
3
2 1 3
3 1 2
Reverse of a give stack is 3 1 2 where first element becomes last and last becomes first.
2
3 2
2 3
0 <= N <= 10^3
Where 'N' is the number of elements in the given stack.
Time Limit: 1 sec