题解 | #买卖股票的最好时机 ii#
买卖股票的最好时机 ii
http://www.nowcoder.com/practice/572903b1edbd4a33b2716f7649b4ffd4
class Solution:
def maxProfit(self , prices ):
# write code here
maxpro = 0
n = len(prices)
for i in range(n-1):
if prices[i+1]>prices[i]:
maxpro+=prices[i+1]-prices[i]
return maxpro