Challenge 2: Reverse a Stack
Given a stack, reverse the contents of the stack.
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
Access this course and 1400+ top-rated courses and projects.