Implement MinStack with push(x), pop() (returns the value), top(), get_min() and __len__, all in O(1). pop, top and get_min on an empty stack raise IndexError.
#stacks#design2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit