标签:
基本动归题
可以压缩状态空间
代码:
1 int climbStairs(int n) { 2 if (n <= 0) 3 return 0; 4 5 int count = 1; 6 int tmp = 1; 7 8 for (int i = 2; i <= n; i++) { 9 int t = count; 10 count += tmp; 11 tmp = t; 12 } 13 14 return count; 15 }
标签:
原文地址:http://www.cnblogs.com/boring09/p/4267063.html