@@ -0,0 +1,1037 @@
+package leetcode.count_and_say;%0A%0Aimport java.util.ArrayList;%0A%0Apublic class Solution %7B%0A    public String countAndSay(int n) %7B%0A    %09if(n == 0) return %22%22;%0A    %09ArrayList%3CInteger%3E cas = new ArrayList%3CInteger%3E();%0A    %09ArrayList%3CInteger%3E next = new ArrayList%3CInteger%3E();%0A    %09cas.add(1);%0A    %09while(--n %3E 0)%7B%0A    %09%09int cnt = 0;%0A    %09%09for(int i = 0; i %3C cas.size(); i += cnt)%7B%0A    %09%09%09int c = cas.get(i);%0A    %09%09%09cnt = 1;%0A    %09%09%09if(i + 1 %3C cas.size())%7B%0A    %09%09%09%09if(cas.get(i + 1) == c)%7B%0A    %09%09%09%09%09cnt++;%0A    %09%09%09%09%09if(i + 2 %3C cas.size())%7B%0A    %09%09%09%09%09%09if(cas.get(i + 2) == c)%7B%0A    %09%09%09%09%09%09%09cnt++;%0A    %09%09%09%09%09%09%7D%0A    %09%09%09%09%09%7D%0A    %09%09%09%09%7D%0A    %09%09%09%7D%0A    %09%09%09next.add(cnt);%0A    %09%09%09next.add(c);%0A    %09%09%7D%0A    %09%09cas.clear();%0A    %09%09cas = next;%0A    %09%09next = new ArrayList%3CInteger%3E();%0A    %09%7D%0A    %09StringBuilder sb = new StringBuilder();%0A    %09for(int c : cas)%7B%0A    %09%09sb.append(c);%0A    %09%7D%0A    %09return sb.toString();%0A    %7D%0A    %0A    public static void main(String%5B%5D args)%7B%0A    %09for(int i = 0; i %3C 30; i++)%7B%0A    %09%09System.err.println(new Solution().countAndSay(i));%0A    %09%7D%0A    %7D%0A%7D%0A

Add java solution for 38. Count and Say