package ioc.Programmatic;

/**
 * Created by Jo on 10/9/16.
 */
public class Solution {
	public int climbStairs(int n) {
		if(n != 1) {
			int n1 = 1;
			int n2 = 2;
			int a = n - 2;
			while (a-- > 0) {
				int tmp = n1;
				n1 = n2;
				n2 = n2 + tmp;
			}
			return n2;
		}
		else {
			return 1;
		}
	}
	public static void main(String[] args){
		Solution solution = new Solution();
		System.out.println(solution.climbStairs(10));
	}
}

@@ -20,16 +20,121 @@
 matic;%0A%0A
+import com.sun.tools.hat.internal.util.ArraySorter;%0A%0Aimport java.util.Arrays;%0Aimport java.util.HashMap;%0A%0A
 /**%0A * C
@@ -190,225 +190,1025 @@
 n %7B%0A
-%09
+    
 public 
-int climbStairs(int n) %7B%0A%09%09if(n != 
+String addStrings(String num1, String num2) %7B%0A%09%09if(num1.length()==1 && num2.length()==
 1)
- 
 %7B%0A%09%09%09
-int n1 = 1;%0A%09
+return (num1.toCharArray()%5B0%5D-'0' + num2.toCharArray()%5B0%5D-'0')+%22%22;%0A%09%09%7D%0A
 %09%09int 
-n2 = 2
+x = num1.length()-num2.length()
 ;%0A%09%09
-%09int
+String
  a
+2
  = 
-n - 2;%0A%09%09%09while (a-- %3E 0) %7B%0A%09%09%09%09int tmp
+%22%22;%0A%09%09String b2 = %22%22;%0A%09%09if(x%3E0)%7B%0A%09%09%09StringBuffer a1 = new StringBuffer();%0A%09%09%09for(int i=0;i%3Cx;i++) %7B%0A%09%09%09%09a1.append(%220%22);%0A%09%09%09%7D%0A%09%09%09a2 = a1.toString()+num2;%0A%09%09%09b2
  = n
+um
 1;%0A%09%09
-%09%09n1 = n2;%0A%09%09%09%09n2 = n2 + tmp
+%7D%0A%09%09else %7B%0A%09%09%09StringBuffer b1 = new StringBuffer();%0A%09%09%09for(int i=0;i%3C-x;i++)%7B%0A%09%09%09%09b1.append(%220%22);%0A%09%09%09%7D%0A%09%09%09b2 = b1.toString()+num1;%0A%09%09%09a2 = num2
 ;%0A
-%09
 %09%09%7D%0A%09%09
-%09return n2;%0A
+char%5B%5D a = a2.toCharArray();%0A%09%09char%5B%5D b = b2.toCharArray();%0A%09%09StringBuffer z = new StringBuffer();%0A%09%09int%5B%5D sum = new int%5Ba.length+1%5D;%0A%09%09for(int i =a.length-1;i%3E=0;i--)%7B%0A%09%09%09if(sum%5Bi+1%5D+(a%5Bi%5D-'0')+(b%5Bi%5D-'0')%3E9)%7B%0A%09%09%09%09sum%5Bi+1%5D+=(a%5Bi%5D-'0')+(b%5Bi%5D-'0');%0A%09%09%09%09sum%5Bi%5D++;%0A%09%09%09%09sum%5Bi+1%5D=sum%5Bi+1%5D%2510;%0A%09
 %09%09%7D%0A
+%09
 %09%09else
- %7B%0A%09%09%09return 1;%0A%09%09%7D%0A%09
+%7B%0A%09%09%09%09sum%5Bi+1%5D = sum%5Bi+1%5D+(a%5Bi%5D-'0')+(b%5Bi%5D-'0');%0A%09%09%09%7D%0A%09%09%7D%0A%09%09for(int f : sum)%7B%0A%09%09%09z.append(f);%0A%09%09%7D%0A%09%09String back = z.toString().replaceFirst(%22%5E0*%22,%22%22);%0A%09%09return back;%0A    
 %7D%0A%09p
@@ -1318,22 +1318,28 @@
 ion.
-climbStairs(10
+addStrings(%2299%22, %229%22
 ));%0A

add programmatic