Description:
Solution:
We should consider if the number is two digits case: 10, 20
Since A-Z is 26, 20-26 is the right range for decode.
ex) s = "112"
dp[3] = 1
dp[2] = 1
dp[1] = 1 + 1 = 2
dp[0] = 2 + 1 = 3
Space Complexity: O(1)
'LeetCode ๐๏ธ > Dynamic Programming' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
55. Jump Game (0) | 2023.07.06 |
---|---|
62. Unique Paths (0) | 2023.07.05 |
213. House Robber II (0) | 2023.07.02 |
198. House Robber (0) | 2023.07.01 |
377. Combination Sum IV (0) | 2023.06.30 |