https://leetcode-cn.com/problems/climbing-stairs/
func climbStairs(_ n: Int) -> Int {
if n <= 1 {return 1}
var first = 1
var second = 2
for _ in stride(from: 3, to: n + 1, by: 1) {
let sum = first + second
first = second
second = sum
}
return second
}
网友评论