题目: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 complet...
分类:
编程语言 时间:
2015-02-01 10:46:16
阅读次数:
251
思路: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 ...
分类:
编程语言 时间:
2015-01-31 21:47:24
阅读次数:
180
MessageDlg('Choose a button:', System.UITypes.TMsgDlgType.mtInformation, [ System.UITypes.TMsgDlgBtn.mbYes, System.UITypes.TMsgDlgBtn.mb...
分类:
移动开发 时间:
2015-01-31 14:25:12
阅读次数:
137
原题:2857. Digit SortingTime Limit: 1.0 Seconds Memory Limit: 65536KTotal Runs: 3234 Accepted Runs: 1704Several players play a game. Each player choose....
分类:
其他好文 时间:
2015-01-31 12:04:15
阅读次数:
185
原题地址Best Time to Buy and Sell Stock III(参见这篇文章)的简化版迭代法求最大利润。当然是在峰值卖出,在低谷买进利润最大了。所以从后向前遍历所有价格,如果当前价格比之前的峰值价格还高,更新峰值价格,否则就用峰值价格减去当前价格看看利润多少。代码: 1 int ma...
分类:
其他好文 时间:
2015-01-30 17:22:44
阅读次数:
125
最近网上都搜不到Taylor的歌了,分享一张love best的album给大家,支持霉霉的还是去买正版把~专辑曲目:01. “Jump Then Fall” 03:5702. “Untouchable” 05:1103. “Forever & Always” (Piano Version) 04:...
分类:
编程语言 时间:
2015-01-30 16:58:50
阅读次数:
160
原题地址如果不限交易次数,把所有递增序列差值求和即可。代码: 1 int maxProfit(vector &prices) { 2 if (prices.empty()) 3 return 0; 4 5 int profi...
分类:
其他好文 时间:
2015-01-30 16:54:46
阅读次数:
129
Say you have an array for which the ith element isthe price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete as manytransactions as you like (ie, buy one an...
分类:
其他好文 时间:
2015-01-30 09:11:13
阅读次数:
176
To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mat...
分类:
编程语言 时间:
2015-01-30 07:54:12
阅读次数:
296
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing ba...
分类:
其他好文 时间:
2015-01-30 07:54:12
阅读次数:
166