Guest User

Untitled

a guest
Jun 24th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. class Solution {
  2. func climbStairs(_ n: Int) -> Int {
  3. var fibs = [0, 1, 1]
  4. for index in 1 ... n+1 {
  5. if index <= 2 {
  6. continue
  7. }
  8. fibs.append(fibs[index - 1] + fibs[index - 2])
  9.  
  10. }
  11. return fibs.last!
  12. }
  13. }
Add Comment
Please, Sign In to add comment