9. Bookshops in London 伦敦书店 (1) Londoner are greater readers.They buy vast numbers of newspapers and magazines and even of books—especially paperbacks ...
分类:
其他好文 时间:
2019-04-24 23:33:30
阅读次数:
342
Array Easy + Medium 1. 121. Best Time to Buy and Sell Stock 一次买入一次卖出,求最大利润.. 维护最小值,用buy保存下标,同时维护当前遍历得到的最大利润。 2. Best Time to Buy and Sell Stock II 不限制 ...
分类:
其他好文 时间:
2019-04-19 16:03:30
阅读次数:
131
题意 Language:DefaultBuy Tickets Time Limit: 4000MSMemory Limit: 65536KTotal Submissions: 25813Accepted: 12368DescriptionRailway tickets were difficult ...
分类:
其他好文 时间:
2019-04-06 09:16:24
阅读次数:
117
题源:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-iv/ 本题代码: 整体思路: 要进行n次交易,至少需要2n天,如果k大于或等于数组长度的一半,那么这题就退化为买卖股票的最佳时机 II,采用贪心法来做(见Leet ...
分类:
其他好文 时间:
2019-04-05 19:50:50
阅读次数:
178
George and Job CodeForces - 467C The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough ...
分类:
其他好文 时间:
2019-04-05 00:37:21
阅读次数:
226
"传送门" 感觉自己真的蠢 这题用堆来做 对于每个数都考虑当前时间点强制卖出,所以每次选择堆中最小的去统计答案 这样不一定最优,所以考虑将除了第一个点外的其他点加两次 这样统计答案时,如果堆中找到的是当前点,那么直接去掉,不产生贡献,说明当前点只能买入 否则找到其他点,就视作在当前点卖出,无脑在当前 ...
分类:
其他好文 时间:
2019-04-01 21:23:02
阅读次数:
400
class Solution(object): def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ if not prices: return 0 buy = -prices[0] sell = 0 for ...
分类:
其他好文 时间:
2019-03-17 14:10:22
阅读次数:
176
https://www.cnblogs.com/grandyang/p/4997417.html https://blog.csdn.net/qq508618087/article/details/51671504 用buy、sell两个数组表达,注意初始化 ...
分类:
其他好文 时间:
2019-03-07 17:48:30
阅读次数:
153
RSplayersthereisthechangeslistedinthispostwrapupeverythingthatwaspolledinbothSkillingweekandRe-runweek,minustheSpecialAttackOrbchangewhichhasbeenheldbackforfurthertesting.Wearenowlookingtomakeastarton
分类:
其他好文 时间:
2019-03-02 18:40:59
阅读次数:
115
Mohammad has recently visited Switzerland. As he loves his friends very much, he decided to buy some chocolate for them, but as this fine chocolate is ...
分类:
其他好文 时间:
2019-02-20 09:35:38
阅读次数:
104