class Solution:
def maxProfit(self, prices: List[int]) -> int:
# 贪心算法
# 每天买入卖出
profit = 0
for i in range(1,len(prices)):
tmp = prices[i]-prices[i-1]
# 如果当前交易tmp是大于0的,加入交易,否则忽略
if tmp>0:
profit += tmp
return profit