@@ -0,0 +1,1004 @@
+import java.util.Stack;%0A%0A/**%0A * %E8%AE%BE%E8%AE%A1%E4%B8%80%E4%B8%AA%E6%9C%89getMin%E5%8A%9F%E8%83%BD%E7%9A%84%E6%A0%88%0A * Created by Bob on 15/11/2.%0A */%0Apublic class C1_1_1 %7B%0A    private Stack%3CInteger%3E stackData;%0A    private Stack%3CInteger%3E stackMin;%0A%0A    public C1_1_1()%7B%0A        this.stackData= new Stack%3C%3E();%0A        this.stackMin= new Stack%3C%3E();%0A    %7D%0A%0A    public void push (int newNum)%7B%0A        if (this.stackMin.isEmpty()) %7B%0A            this.stackMin.push(newNum);%0A        %7D else if (newNum %3C= this.getMin()) %7B%0A            this.stackMin.push(newNum);%0A        %7D%0A        this.stackData.push(newNum);%0A    %7D%0A%0A    public int pop()%7B%0A        if (this.stackData.isEmpty()) %7B%0A            throw new RuntimeException(%22your stack is empty%22);%0A        %7D%0A        int value= this.stackData.pop();%0A        if (value== this.getMin())%7B%0A            this.stackMin.pop();%0A        %7D%0A        return value;%0A    %7D%0A%0A    public int getMin()%7B%0A        if (this.stackMin.isEmpty())%7B%0A            throw new RuntimeException(%22your stack is empty%22);%0A        %7D%0A        return this.stackMin.peek();%0A    %7D%0A%7D%0A

chapter1.question1.1