Skip to content

Commit 65df286

Browse files
authored
[20251119] PGM / LV2 / 멀리 뛰기 / 강신지
1 parent 5a81559 commit 65df286

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
```java
2+
class Solution {
3+
public long solution(int n) {
4+
int[] dp = new int[n+1];
5+
6+
if (n == 1) return 1;
7+
if (n == 2) return 2;
8+
dp[1] = 1;
9+
dp[2] = 2;
10+
11+
for (int i=3; i<=n; i++){
12+
dp[i] = (dp[i-1] + dp[i-2])%1234567;
13+
}
14+
15+
return dp[n];
16+
}
17+
}
18+
```

0 commit comments

Comments
 (0)