Python implementation of stack to return minimum in O(1) time
The minimum gets updated after a push but not after a pop, causing getMinimum to return the wrong value:

&gt;&gt;&gt; stack = Stack()
&gt;&gt;&gt; stack.push(2)
&gt;&gt;&gt; stack.push(1)
&gt;&gt;&gt; stack.getMinimum()
1 # correct
&gt;&gt;&gt; stack.pop()
1
&gt;&gt;&gt; stack.getMinimum()
1 # wrong: the only item in the stack now is the number 2