Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- func climbStairs(_ n: Int) -> Int {
- var fibs = [0, 1, 1]
- for index in 1 ... n+1 {
- if index <= 2 {
- continue
- }
- fibs.append(fibs[index - 1] + fibs[index - 2])
- }
- return fibs.last!
- }
- }
Add Comment
Please, Sign In to add comment