https://oj.leetcode.com/problems/min-stack/

http://blog.csdn.net/linhuanmars/article/details/41008731

class MinStack {
    public void push(int x) {
        data.push(x);
        if (min.empty() || (x <= (int)min.peek()))
        {
            min.push(x);
        }
    }

    public void pop() {
        if (data.empty())
            return;
        
        int toReturn = (int)data.pop();
        if ((int)min.peek() == toReturn)
        {
            min.pop();
        }
    }

    public int top() {
        return (int)data.peek();
    }

    public int getMin() {
        return (int)min.peek();
    }
    
    private Stack data = new Stack();
    private Stack min = new Stack();
}