Description:
Solution:
We have to consider three cases:
- The first value of the array is the biggest number.
- Except the first value, try to find the maximum of the other values.
- Except the last value, try to find the maximum of the other values.
Time Complexity: O(n)
Space Complexity: O(1)
'LeetCode ๐๏ธ > Dynamic Programming' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
62. Unique Paths (0) | 2023.07.05 |
---|---|
91. Decode Ways (0) | 2023.07.04 |
198. House Robber (0) | 2023.07.01 |
377. Combination Sum IV (0) | 2023.06.30 |
139. Word Break (0) | 2023.06.29 |