非波拉起数列

master
alis-lc 1 year ago
parent 4aae3ec3f1
commit a0989eb20d

@ -13,27 +13,10 @@ public class LeetCode17 {
System.out.println(count);
}
private static Integer advanced(Integer n) {
if (n == 1) {
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;
private static int advanced(int n) {
if (n == 1 || n==2) {
return n;
}
return temp;
return ladder(n - 1) + ladder(n - 2);
}
}
Loading…
Cancel
Save