Showing posts with label Stack Interview Questions. Show all posts
Showing posts with label Stack Interview Questions. Show all posts

Thursday, December 11, 2014

How to find min Stack using min time

Number of Stacks: 2

Push: Push the items in S1 and Push the item to S2 if the item (top) is less than S1

Pop: Pop the item from S2 because its min value and compare with S1, if both are same then pop item from S1 also.

Popped item is min