@@ -0,0 +1,890 @@
+package org.speedfirst.leetcode.not_in_oj;%0A%0Aimport java.util.Stack;%0A%0A/**%0A * Sort numbers in stack%0A */%0Apublic class StackSort %7B%0A    // use only push, pop peek to sort a stack%0A    public Stack%3CInteger%3E sort(Stack%3CInteger%3E s) %7B%0A        Stack%3CInteger%3E r = new Stack%3C%3E();%0A        while (!s.empty()) %7B%0A            int cur = s.pop();%0A            if (!r.empty() && cur %3C r.peek()) %7B%0A                while(!r.empty()) %7B%0A                    int tmp = r.pop();%0A                    s.push(tmp);%0A                %7D%0A            %7D%0A            r.push(cur);%0A        %7D%0A%0A        return r;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Stack%3CInteger%3E s = new Stack%3C%3E();%0A        s.push(4);%0A        s.push(2);%0A        s.push(8);%0A        s.push(1);%0A        s.push(6);%0A%0A        Stack%3CInteger%3E r = new StackSort().sort(s);%0A        for (int i : r) %7B%0A            System.out.println(i);%0A        %7D%0A    %7D%0A%7D%0A

add StackSort