Challenge 2: Reverse a Stack
Given a stack, reverse the contents of the stack.
We'll cover the following
Problem Statement
Implement a function that takes a stack, testVariable
, and reverses it. Do not use any other extra stack or data structure.
Helper functions are provided in the file
stack.py
. Take a look at the file before implementing your solution.
Input
A variable testVariable
that contains a stack.
Output
No explicit output. Our task is to reverse the contents of the stack.
Sample Input
8, 5, 3, 2
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.