class Solution { public: int climbStairs(int n) { if(n == 1)return 1; if(n == 2)return 2; int x = 1; int y = 2; while(n-2){ int t = y; y = x+y; x = t; n--; } return y; } };
Leetcode 70
猜你喜欢
转载自www.cnblogs.com/cunyusup/p/9832542.html
今日推荐
周排行