最简单的DP!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Solution {
/**
* 最简单的DP!
*/
public int climbStairs(int n) {
int[] f = new int[n+2];
f[0] = 0;
f[1] = 1;
for (int i = 0; i < n; i++) {
f[i+2] = f[i] + f[i+1];
}
return f[n+1];
}
}

Comments
Recent Posts
计算机网络
进程树
进程管理
Categories
Website Info
Article Count :
4
Total Word Count :
14.4k
Unique Visitors :
Page Views :
Last Update :