【Leetcode】Best Time to Buy and Sell Stock III.pdfVIP

  • 36
  • 0
  • 约4.4千字
  • 约 4页
  • 2017-09-16 发布于浙江
  • 举报

【Leetcode】Best Time to Buy and Sell Stock III.pdf

为为梦梦起起航航 不不积积小小流流无无以以成成江江海海 【【LLeeeettccooddee】】BBeesstt TTiimmee ttoo BBuuyy aanndd eellll ttoocckk IIIIII 分类: leetcode 动态规划 2013-12-15 17:46 239人阅读 评论 (0) 收藏 举报 动态规划最大收益C++leetcode Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most two transactions. Note: You may not engage in multiple transactions at the same time (ie, you must sell the stock efore you uy again). 题意:获取股票最大收益,最多可交易两次,且必须完成一桩交易之后才能 进行另一桩交易。当然,可以第i天卖出后又当天买回。 因为最多两次交易,很容易联想到将数组分为两部分,对两

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档