码迷,mamicode.com
首页 >  
搜索关键字:buy and sell stock    ( 1705个结果
[Leetcode] Best Time to Buy and Sell Stock II
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:其他好文   时间:2014-10-16 15:26:02    阅读次数:169
[Leetcode] Best Time to Buy and Sell Stock
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-10-16 09:30:02    阅读次数:193
Leetcode:best_time_to_buy_and_sell_stock
同样是买卖股票,求出最大的利润,不过只能买和卖一次。...
分类:其他好文   时间:2014-10-15 00:23:39    阅读次数:199
google在线测试练习题1
Problem You receive a credit C at a local store and would like to buy two items. You first walk through the store and create a list L of all available items. From this list you would like to buy tw...
分类:其他好文   时间:2014-10-12 12:38:28    阅读次数:241
LeetCode——Best Time to Buy and Sell Stock III (股票买卖时机问题3)
问题: 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 co...
分类:其他好文   时间:2014-10-12 00:58:36    阅读次数:686
1438. Shopaholic
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionLindsay is a shopaholic. Whenever there is a discount of the kind where you can buy three...
分类:其他好文   时间:2014-10-11 22:47:36    阅读次数:191
Best Time to Buy and Sell Stock (java)
有一组数组代表股票的价格一次买一次卖如何得到最大利润? 1 public int maxProfit(int[] prices) { 2 if(prices.length==0)return 0; 3 int maxProfit=0; 4 in...
分类:编程语言   时间:2014-10-11 22:08:36    阅读次数:174
poj2828 buy tickets(线段树单点更新)
题目链接: huangjing 思路: 因为给出了n条插入,所以如果正推的话,那么后面插的会影响到最后所在的位置,所以考虑逆序解决,那么如果此人站在第i个人的位置,那么这个人前面必然有i个空位置没占,因为是从后向前考虑的,所以每次更新的时候就要考虑在前面存在i个空位的位置后插入这个人,那么最后得到的序列就是满足条件的。。 题目: Language: Defaul...
分类:其他好文   时间:2014-10-10 11:43:04    阅读次数:238
LeetCode——Best Time to Buy and Sell Stock II (股票买卖时机问题2)
问题: 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 co...
分类:其他好文   时间:2014-10-10 00:18:11    阅读次数:398
Best Time to Buy and Sell Stock I,II,III [leetcode]
Best Time to Buy and Sell Stock I 只能作一次操作时:维护preMin记录之前出现的最小值 代码如下: int maxProfit(vector &prices) { if (prices.size() == 0) return 0; int profit = 0; int preMin = prices...
分类:其他好文   时间:2014-10-10 00:02:08    阅读次数:204
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!