Looking for good programming challenges?

Use the search below to find our solutions for selected questions!

Stack with min() operation

Sharing is caring!

Problem Statement
Create a stack data structure that supports the following operations as efficiently as possible:

Push, which adds a new element atop the stack,
Pop, which removes the top element of the stack,
Find-Min, which returns (but does not remove) the smallest element of the stack

Full Code