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 ...
分类:
其他好文 时间:
2015-01-06 15:41:54
阅读次数:
189
相比于数组这种存储数据的数据,栈(Stock)和队列(Queue)主要作用是在程序中作为构思算法的辅助工具,是一种程序员开发过程中的便利工具。Stock和Queue具有访问受限以及更加抽象的特征。一、栈栈只允许访问最后一个插入的元素,即栈是先进后出(FILO)的一种数据结构。栈主要提供的算法包括pu...
分类:
其他好文 时间:
2015-01-06 11:26:41
阅读次数:
266
Asia Stock ExchangesJuly 7, 2009This article is to summarise the trading rules of some Asia stockexchanges. Those rules are very important to know if ...
分类:
其他好文 时间:
2015-01-05 16:23:02
阅读次数:
237
http://poj.org/problem?id=2828
题意:有n个的排队,每一个人都有一个val来对应,每一个后来人都会插入当前队伍的某一个位置pos。要求把队伍最后的状态输出。
逆向思考。这样考虑,最后一个人一定会得到当前队伍他想要的位置,如果我们往前一个阶段,倒数第二个人也一定能得到他想要的位置……,也就是说,我们可以这样处理,我们把最后一个人插入,然后忽略它,再把...
分类:
其他好文 时间:
2015-01-04 21:25:59
阅读次数:
160
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 ...
分类:
其他好文 时间:
2015-01-04 17:14:20
阅读次数:
130
Best Time to Buy and Sell Stock IIQuestion SolutionSay you have an array for which the ith element is the price of a given stock on day i.Design an al...
分类:
其他好文 时间:
2015-01-03 19:45:09
阅读次数:
140
Best Time to Buy and Sell Stock IIIQuestion SolutionSay you have an array for which the ith element is the price of a given stock on day i.Design an a...
分类:
其他好文 时间:
2015-01-03 19:43:30
阅读次数:
171
Best Time to Buy and Sell StockSay you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to compl...
分类:
其他好文 时间:
2015-01-03 19:43:30
阅读次数:
205
Algorithm: Scan through the array, keep finding 1. prices[i] with the condition: prices[i] prices[i+1], or at the end of an ascending trend, trea...
分类:
其他好文 时间:
2014-12-31 06:16:24
阅读次数:
159
Best Time to Buy and Sell Stock IIISay you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the...
分类:
其他好文 时间:
2014-12-30 23:16:18
阅读次数:
268