Problem statement

You have to implement the min_stack class, which has a min() function. Whenever min() is called, the minimum value of the stack is returned in O(1) time. The element is not popped from the stack. Its value is simply returned.

Input

The input will be a stream of numbers ...

Create a free account to view this lesson.

Continue your learning journey with a 14-day free trial.

By signing up, you agree to Devpath's Terms of Service and Privacy Policy