|
|
@ -13,27 +13,10 @@ public class LeetCode17 {
|
|
|
|
System.out.println(count);
|
|
|
|
System.out.println(count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static Integer advanced(Integer n) {
|
|
|
|
private static int advanced(int n) {
|
|
|
|
|
|
|
|
if (n == 1 || n==2) {
|
|
|
|
if (n == 1) {
|
|
|
|
return n;
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (n == 2) {
|
|
|
|
|
|
|
|
return 2;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int a = 1;
|
|
|
|
|
|
|
|
int b = 2;
|
|
|
|
|
|
|
|
int temp = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 3; i <= n; i++) {
|
|
|
|
|
|
|
|
temp = a + b;
|
|
|
|
|
|
|
|
a=b;
|
|
|
|
|
|
|
|
b=temp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return temp;
|
|
|
|
return ladder(n - 1) + ladder(n - 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|