Y
Hacker News
new
|
ask
|
show
|
jobs
by
wadeboggs
3410 days ago
Make another stack with the latest minimum, then when you pop that top value, you also pop it off the minimums stack. Then you have the last minimum before that one.
Is that it?
2 comments
sand500
3410 days ago
What if you added values that are greater then the minimum at the top of the minimum stack but less than the next value on the minimum stack?
link
antoaravinth
3410 days ago
Your using two stacks now. This is the solution that I had told but your not satisfying the condition w.r.t to space , its O(n) not O(1).
link