Stack Bash - Master data structures and algorithms

Stack with Max

Medium
Implement 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 stack
  • pop - Pops the last number out of the stack
  • get_max - The maximum number in the stack.

Try it first

Solution

6 Essential Stacks & Queues Coding Interview Problems

Master Stacks & Queues by trying the coding challenges below.
  1. 1.Implement StackEasy
  2. 2.Implement QueueEasy
  3. 3.Valid stack sequenceMedium
  4. 4.Max StackMedium
  5. 5.Valid ParenthesesMedium
  6. 6.Simplify PathMedium