Design a stack based data structure in which i can access the minimum element with least time complexity
Anoniem
Brute force Solution - maintain a variable called minElement. After every push and pop, scan the entire stack and update this variable. Use 2 stacks - in 2nd stack keeping pushing if current element < stack top