Skip to content

Commit 50ea04c

Browse files
committed
Solution Climbing Stairs
1 parent 33b1096 commit 50ea04c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

climbing-stairs/doitduri.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
func climbStairs(_ n: Int) -> Int {
3+
var tables = [0, 1, 2]
4+
for i in 3...45 {
5+
let result = tables[i-1] + tables[i-2]
6+
tables.append(result)
7+
}
8+
9+
return tables[n]
10+
}
11+
}

0 commit comments

Comments
 (0)