electroRF
Member
I encountered this question and i'm trying to see logically how to implement it.
Design a stack which allows pop / push / peek min/ delete min in O(1).
please notice that when one deletes the min, the stack should know now what is the next min, in O(1) of course.
Do you have an idea how to approach it?
Thank you.
Design a stack which allows pop / push / peek min/ delete min in O(1).
please notice that when one deletes the min, the stack should know now what is the next min, in O(1) of course.
Do you have an idea how to approach it?
Thank you.