DIY: Min Stack

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 ...

Create a free account to view this lesson.

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