Description:
Solution:
From the last value, we are gonna update the goal pointer when i + nums[i] >= goal.
The reason we do ">=" is that we can skip the index. The previous value of the last, we can skip that index.
When the goal pointer reach out the nums[0], then it is True.
Time Complexity: O(n)
'LeetCode ๐๏ธ > Dynamic Programming' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
62. Unique Paths (0) | 2023.07.05 |
---|---|
91. Decode Ways (0) | 2023.07.04 |
213. House Robber II (0) | 2023.07.02 |
198. House Robber (0) | 2023.07.01 |
377. Combination Sum IV (0) | 2023.06.30 |