min function of stack with O(1) time