Skip to content

Commit 0f4baad

Browse files
committed
Climbing Stairs
1 parent 22aec36 commit 0f4baad

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

climbing-stairs/iam-edwin.java

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
public int climbStairs(int n) {
3+
int[] result = new int[n + 1];
4+
result[0] = 1;
5+
result[1] = 1;
6+
7+
for (int i = 2; i < n + 1; i++) {
8+
result[i] = result[i - 1] + result[i - 2];
9+
}
10+
11+
return result[n];
12+
}
13+
}

0 commit comments

Comments
 (0)