[๋ฌธ์ ๋งํฌ] ๐
ํ๋ก๊ทธ๋๋จธ์ค
SW๊ฐ๋ฐ์๋ฅผ ์ํ ํ๊ฐ, ๊ต์ก, ์ฑ์ฉ๊น์ง Total Solution์ ์ ๊ณตํ๋ ๊ฐ๋ฐ์ ์ฑ์ฅ์ ์ํ ๋ฒ ์ด์ค์บ ํ
programmers.co.kr
Solution
def solution(n):
dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 2
for i in range(2, n):
dp[i] = dp[i - 2] + dp[i - 1]
return dp[n - 1] % 1234567
'๐งฉ Algorithm > [Programmers] Level 2' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| [Programmers] L1. ๋ช ์์ ์ ๋น (์ต์ ํ/Python) (0) | 2024.11.16 |
|---|---|
| [Programmers] L2. ๊ทค ๊ณ ๋ฅด๊ธฐ (Greedy/Python) (0) | 2024.11.16 |
| [Programmers] L2. ๊ตฌ๋ช ๋ณดํธ (Python/ํฌ ํฌ์ธํฐ) (0) | 2024.11.15 |
| [Programmers] L2. ์์ด ๋๋ง์๊ธฐ (Python) (1) | 2024.11.11 |
| [Programmers] L2. ์ ํ์ ์๊ฐ ์ด๋ (Python) (0) | 2024.11.11 |