public class Solution {
    public List<Integer> lexicalOrder(int n) {
        List<Integer> res = new ArrayList<Integer>();
        if(n<0){
            return res;
        }
        List<String> help = new LinkedList<String>();
        for(int i=1;i<=n;i++){
            help.add(String.valueOf(i));
        }
        Collections.sort(help);
        for(String num:help){
            res.add(Integer.valueOf(num));
        }
        return res;
    }
}
@@ -445,10 +445,1053 @@
 s;%0A    %7D
+%0A%0A    public List%3CInteger%3E lexicalOrder(int n)%7B%0A        List%3CInteger%3E res = new ArrayList%3C%3E();%0A        for(int i=1;i%3C10;++i)%7B%0A            dfs(i, n,res);%0A        %7D%0A        return res;%0A    %7D%0A%0A    private void dfs(int cur, int n,List%3CInteger%3E res)%7B%0A        if(cur%3En)%7B%0A            return;%0A        %7Delse%7B%0A            res.add(cur);%0A            for(int i=0;i%3C10;i++)%7B%0A                if(10*cur+i%3En)%7B%0A                    return;%0A                %7D%0A                dfs(10*cur+i,n,res);%0A            %7D%0A        %7D%0A    %7D%0A%0A    public List%3CInteger%3E lexicalOrder(int n) %7B%0A        List%3CInteger%3E list = new ArrayList%3C%3E(n);%0A        int curr = 1;%0A        for (int i = 1; i %3C= n; i++) %7B%0A            list.add(curr);%0A            if (curr * 10 %3C= n) %7B%0A                curr *= 10;%0A            %7D else if (curr %25 10 != 9 && curr + 1 %3C= n) %7B%0A                curr++;%0A            %7D else %7B%0A                while ((curr / 10) %25 10 == 9) %7B%0A                    curr /= 10;%0A                %7D%0A                curr = curr / 10 + 1;%0A            %7D%0A        %7D%0A        return list;%0A    %7D
 %0A%7D

add new solution