码迷,mamicode.com
首页 >  
搜索关键字:buy and sell stock    ( 1705个结果
Best Time to Buy and Sell Stock III <leetcode>
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-09-07 14:41:25    阅读次数:240
Best Time to Buy and Sell Stock <leetcode>
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-09-07 13:24:55    阅读次数:229
POJ 2828——Buy Tickets(树状数组,线段树——逆序遍历)
Buy Tickets Time Limit: 4000MS   Memory Limit: 65536K Total Submissions: 13496   Accepted: 6726 Description Railway tickets were difficult to buy around the Lunar New Y...
分类:其他好文   时间:2014-09-04 10:35:20    阅读次数:276
POJ 2828 Buy Tickets (线段树 单点更新 插队问题)
没想到用线段树是我遇到的第一个问题,第二个便是建树。一般情况下,都是1-n建树,而这个题,最好是0-n-1建树,很方便。其实刚开始没有大胆尝试是因为没有意识到线段树的每个节点的l、r和rt是没有什么必然关系的,l、r控制着左右端点,而rt只不过是一个下标罢了,仅仅是表示保存在了数组哪个位置。其相对独立。还有便是线段树节点的含义,每个子叶表示一个位置,其父节点存储了可用的位置数,每加入一个成员,便占用一个位置,而节点的编号便是这个成员的最终位置。对于建树的最后一个问题,怎么把每个人加入到树中?因为对于这个题,...
分类:其他好文   时间:2014-09-03 18:13:56    阅读次数:208
根据SPWeb递推得到地下的所有子网站和List的Json
1.开发缘由其实这样的工具很多,在网站中一点点看也是大概能够了解的。但是属于强迫症,总想看一下所有。2.设计思路开始是想做成思维导图的模式,jQuery插件,Html都搜过,结果只找到了http://qunee.com/buy.html。有什么办法呢,只能随便找个tree显示。Json拼写开始以为收...
分类:Web程序   时间:2014-08-31 15:44:41    阅读次数:200
LeetCode--Best Time to Buy and Sell Stock (贪心策略 or 动态规划)
Best Time to Buy and Sell StockTotal Accepted:14044Total Submissions:45572My SubmissionsSay you have an array for which theithelement is the price of ...
分类:其他好文   时间:2014-08-31 14:30:51    阅读次数:249
Best Time to Buy and Sell Stock III 解题思路
题目要求:最多交易两次,并且只能买卖完之后再买。总思路:在数组中找一个适当的点i,使得profit之和最大。思路:1、从左往右扫描,left[i]记录包括i元素以内的左部的maxprofit,用Best Time to Buy and Sell Stock 1可得到。2、从右往左扫描,right[i...
分类:其他好文   时间:2014-08-31 13:13:21    阅读次数:171
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-08-31 13:05:01    阅读次数:176
codeforces A#264. Caisa and Sugar
Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town. Unfortunately, he has just s dollars for sugar. B...
分类:其他好文   时间:2014-08-30 21:47:30    阅读次数:255
uva 1151 - Buy or Build poj 2784 Buy or Build(最小生成树)
也是简单的最小生成树算法 不过添加了一些新的东西,需要对最小生成树算法 以及其中的 并查集的使用 有一些比较深入的理解。 处理问题的方法也有些复杂 #include #include #include #include using namespace std; const int maxn = 1005; struct point { int x; int y; }pp[m...
分类:其他好文   时间:2014-08-30 16:28:59    阅读次数:149
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!