Stack with Max
MediumImplement a
Stack
class that includes an operation to return the maximum number in the stack.Your class should implement the following methods:
push
- adds a number to the stackpop
- Pops the last number out of the stackget_max
- The maximum number in the stack.
Try it first
Solution
5 Essential Stacks & Queues Coding Interview Problems
Master Stacks & Queues by trying the coding challenges below.
- 1.Implement StackEasy
- 2.Implement QueueEasy
- 3.Max StackMedium
- 4.Valid ParenthesesMedium
- 5.Simplify PathMedium