Skip to content

Commit 6959717

Browse files
Create 0070-climbing-stairs.scala
1 parent 91ddab2 commit 6959717

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

scala/0070-climbing-stairs.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
object Solution {
2+
def climbStairs(n: Int): Int = {
3+
var one = 1
4+
var two = 1
5+
for (i <- 0 until n - 1) {
6+
val temp = one
7+
one = one + two
8+
two = temp
9+
}
10+
one
11+
}
12+
}

0 commit comments

Comments
 (0)