摘要:
问题描述: 在股市的交易日中,假设最多可进行两次买卖(即买和卖的次数均小于等于2),规则是必须一笔成交后进行另一笔(即买-卖-买-卖的顺序进行)。给出一天中的股票变化序列,请写一个程序计算一天可以获得的最大收益。请采用实践复杂度低的方法实现。 给定价格序列prices及它的长度n,请返回最大收益。保 阅读全文
posted @ 2016-04-27 16:47
zehua_tongxini
阅读(665)
评论(0)
推荐(0)
摘要:
Question: Find the contiguous subarray within an array (containing at least one number) that has the largest sum. For example, given the array [2, 1, 阅读全文
posted @ 2016-04-27 13:39
zehua_tongxini
阅读(325)
评论(0)
推荐(0)