Leetcode之Best Time to Buy and Sell Stock...
分类:
其他好文 时间:
2014-06-24 22:16:18
阅读次数:
249
class Solution {public: int maxProfit(vector &prices) { int len = prices.size(); if (len < 1) return 0; int sum = 0; in...
分类:
其他好文 时间:
2014-06-24 11:28:47
阅读次数:
193
Buy the souvenirs
Time Limit: 10000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 869 Accepted Submission(s): 298
Problem Description
When the ...
分类:
其他好文 时间:
2014-06-22 18:02:45
阅读次数:
239
BUY LOW, BUY LOWER
Time Limit: 1000MS
Memory Limit: 30000K
Total Submissions: 8311
Accepted: 2883
Description
The advice to "buy low" is half the formula to success i...
分类:
其他好文 时间:
2014-06-21 20:49:18
阅读次数:
304
题目描述It'sYy'sbirthday, and his friends decided to buy him a copy ofXianJianQiXiaZhuanV.Since some of friends have more money available than others, nob...
分类:
其他好文 时间:
2014-06-21 09:03:53
阅读次数:
303
此题应用线段树的方法非常巧妙。没做过真的难想得出是这么想的。
是一个逆向思维的运用。
其实一看到这道题目我就想到要运用逆向思维的了,但是就是没那么容易想通的。
思路:
1 要从后面往前更新线段树
2 线段树记录的是当前区间还剩下多少个记录空间
3 因为后面的插入会使得前面的插入往后退,那么前面插入的下标如果大于前面可以插入的空间,就需要往后退了。
好难理解的操作。仔细观察一下下面up...
分类:
其他好文 时间:
2014-06-19 12:54:26
阅读次数:
248
在UC落入阿里之口之后,开始感概这个时代已经变了,不再是一个天堂了,这已然是一个巨人的时代,一个寡头的时代(Buy Times)。寡头时代带来的恐惧用户信息的记录我不是一个创业者,谁占领了市场对于我来说我是无所谓的。过去的日子里,在互联网上泄露了太多的个人信息,有些是被收集者,如学校、机构等,而后公开在网上的。(ps:这些无良的组织机构)在互联网时代,我们的信息之中多是一些简单的个人资料,也许还包...
分类:
其他好文 时间:
2014-06-17 22:10:34
阅读次数:
248
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 complet...
分类:
其他好文 时间:
2014-06-17 14:57:30
阅读次数:
269
They can usually be purchased in three sizes: £
5, £ 1 and a half pound bags. I even saw them to buy on eBay. Many companies are
cutting Tekpak bag of...
分类:
其他好文 时间:
2014-06-16 09:23:39
阅读次数:
443
Say you have an array for which theithelement
is the price of a given stock on dayi.If you were only permitted to complete at
most one transaction (ie...
分类:
其他好文 时间:
2014-06-13 15:55:47
阅读次数:
273