https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/
from typing import List
class Solution:
def maxProfit(self, prices: List[int]) -> int:
result = 0
for i in range(len(prices) - 1):
if prices[i + 1] > prices[i]:
result += prices[i + 1] - prices[i]
return result
이 문제에서 탐욕적인 접근은 현재 인덱스보다 바로 다음 인덱스의 prices
값이 더 큰 경우 하나만 고려한다.