Reversing a Stack using two empty Stacks
Given a stack S, the task is to reverse the stack S using two additional stacks. Example: Input: S={1, 2, 3, 4, 5}Output: 5 4 3 2 1Explanation:The initial stack S:1âtop2345After reversing it, use two additional stacks:5âtop4321 Input: S={1, 25, 17}Output: 17 25 1 Approach: Follow the steps below to