We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 96ab933 commit 437976fCopy full SHA for 437976f
climbing-stairs/yhkee0404.scala
@@ -0,0 +1,11 @@
1
+object Solution {
2
+ def climbStairs(n: Int): Int = {
3
+ val dp = Array.ofDim[Int](n + 1)
4
+ dp(0) = 1
5
+ dp(1) = 1
6
+ for (i <- 2 to n) {
7
+ dp(i) = dp(i - 1) + dp(i - 2)
8
+ }
9
+ dp(n)
10
11
+}
0 commit comments