Update appNew update is available. Click here to update.
sidenav-btnClose
Topic list
Reverse Stack Using Recursion
EASY
21 mins
145 upvotes
Stacks & Queues
Topics (Covered in this problem)
Problem solved
Badge
Skill meter
Stacks & Queues
-
-
Other topics
Problem solved
Badge
Skill meter
Strings
-
-
Matrices (2D Arrays)
-
-
Linked List
-
-
Sorting
-
-
Binary Search
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
userLevel
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

Reverse Stack Using Recursion

Contributed by
Ashwani
Easy
yellow-spark
0/40
Avg time to solve 21 mins
Success Rate 80 %
Share
145 upvotes

Problem Statement

Reverse a given stack of integers using recursion.

Note:

You are not allowed to use any extra space other than the internal stack space used due to recursion.
You are not allowed to use the loop constructs of any sort available as handy. For example: for, for-each, while, etc. 
The only inbuilt stack methods allowed are:
push(x) -- Push element x onto stack.
pop() -- Removes the element on top of the stack.
top() -- Get the top element.
Detailed explanation ( Input/output format, Notes, Constraints, Images )
Reset Code
Full screen
Auto
copy-code
Console