标签:sel int ice fit ret elf self price integer
class Solution:
# @param {integer[]} prices
# @return {integer}
def maxProfit(self, prices):
profit = 0;
for i in xrange(1, len(prices)):
if prices[i] > prices[i-1]:
profit += prices[i] - prices[i-1]
return profit
Leetcode Best Time to Buy and Sell Stock II
标签:sel int ice fit ret elf self price integer
原文地址:http://www.cnblogs.com/gccbuaa/p/6845562.html