原题:
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (ie, buy one and sell one share of th...
分类:
其他好文 时间:
2014-05-13 14:12:41
阅读次数:
342
本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie
Best Time to Buy and Sell Stock
Total Accepted: 13234 Total
Submissions: 43145
Say you have an array for which the ith ele...
分类:
其他好文 时间:
2014-05-13 07:30:13
阅读次数:
276
显示数据库中的存储过程__转
It's no easy trick to see stored procedures in a database programmatically with a scripting language like ASP. If you're using MS Access, you're out of luck. Access provides no way to ...
分类:
数据库 时间:
2014-05-12 22:43:25
阅读次数:
541
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...
分类:
其他好文 时间:
2014-05-12 05:56:14
阅读次数:
315
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-05-10 00:24:49
阅读次数:
255
转载:http://blog.csdn.net/fightforyourdream/article/details/14503469题目:最佳时间买入卖出股票:你有一个数组保存了股票在第i天的价钱,现在你最多进行两次买卖,但同一时间你手上只能保持一个股票,如何赚的最多思路:知道要用DP做,但是一开始...
分类:
其他好文 时间:
2014-05-09 20:01:47
阅读次数:
335
题目:
Description
People in Silverland use coins.They have coins of value A1,A2,A3...An Silverland dollar.One day Tony opened his money-box and found there were some coins.He decided to buy a very n...
分类:
其他好文 时间:
2014-05-09 15:00:55
阅读次数:
345
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-05-09 13:13:02
阅读次数:
283
这道题虽然是上一道题的增强,但是反而简单了。可以交易无数次,但是买卖必须成对的出现。
为了简单起见,我用abc三股股票来说明,且忽略掉相等的情况。三个数一共有六种大小关系。注意他们之间的先后顺序是不能乱的。
1. a
2. b
3. a
4. b
5. c
6. c
好的,你已经看出来了,只要当相邻的两个数是后面一个较大时,就之间累计上他们的差,否则,pass。直观一点的表述,只要...
分类:
其他好文 时间:
2014-05-07 12:33:11
阅读次数:
512