- Stacks are an abstract data structures.
- They follow LIFO (Last In First Out) or FILO (First In Last Out) principle.
- Stack’s insertion and deletion operations are of O(1) time complexity.
.pop() methods have time complexity of O(1).
- In this challenge we need to
.pop() and then
.push() into the stack.
Solution 1 (Click to Show/Hide)
var homeworkStack = ["BIO12", "HIS80", "MAT122", "PSY44"];