码迷,mamicode.com
首页 >  
搜索关键字:best    ( 2208个结果
Leetcode:best_time_to_buy_and_sell_stock_II题解
假设你有一个数组,它的第i个元素是一个股票在一天的价格。 设计一个算法,找出最大的利润。...
分类:其他好文   时间:2014-10-04 16:57:46    阅读次数:122
BZOJ3394: [Usaco2009 Jan]Best Spot 最佳牧场
3394: [Usaco2009 Jan]Best Spot 最佳牧场Time Limit:1 SecMemory Limit:128 MBSubmit:11Solved:9[Submit][Status]DescriptionInput第1行输入三个整数P,FC.之后F行每行输入一个整数表示一个贝...
分类:其他好文   时间:2014-10-04 02:35:05    阅读次数:336
Best Time to Buy and Sell Stock III
题目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...
分类:其他好文   时间:2014-10-03 13:37:34    阅读次数:225
BZOJ3300: [USACO2011 Feb]Best Parenthesis
3300: [USACO2011 Feb]Best ParenthesisTime Limit:10 SecMemory Limit:128 MBSubmit:89Solved:42[Submit][Status]DescriptionRecently, the cows have been com...
分类:其他好文   时间:2014-10-03 13:23:44    阅读次数:356
LeerCode 123 Best Time to Buy and Sell Stock III之O(n)解法
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-02 13:58:53    阅读次数:321
JavaScript- The Good Parts Chapter 4
Why, every fault’s condemn’d ere it be done:Mine were the very cipher of a function. . .—William Shakespeare, Measure for MeasureThe best thing about ...
分类:编程语言   时间:2014-10-01 14:47:31    阅读次数:190
POJ3617-Best Cow Line
给定长度为N的字符串S,构造长度为N的字符串T,起初T是空串,反复从S的头部或者尾部删除一个字符,加到T的尾部。目标是构造字典序尽可能小的T。尝试如下贪心算法:不断取S头部和尾部较小的字符放到T的尾部。考虑S头部和尾部字符相同的情况。有如下算法:按照字典序比较S和将S反转后的字符串S‘;如果S较小,...
分类:其他好文   时间:2014-09-30 20:28:10    阅读次数:207
leetcode-Best Time to Buy and Sell Stock
一定要判断好边界条件,edge case很关键。 1 #include 2 #include 3 using namespace std; 4 5 class Solution { 6 public: 7 int maxProfit(vector &prices) { 8 ...
分类:其他好文   时间:2014-09-27 19:02:20    阅读次数:202
小结:模拟
技巧及注意:细节方面十分重要,你要想啊,敢出模拟题一定有出模拟题的原因~出题人一定会放很多坑给你,所以在码之前一定要先有大概的思路框架,然后在写代码中思考比如说这题:【BZOJ】3300: [USACO2011 Feb]Best Parenthesis(模拟)一开始我没注意边界问题,所以一直爆wa。...
分类:其他好文   时间:2014-09-26 09:03:38    阅读次数:195
[leetcode] Best Time to Buy and Sell Stock
Problem: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 transac...
分类:其他好文   时间:2014-09-25 21:10:47    阅读次数:171
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!