码迷,mamicode.com
首页 >  
搜索关键字:most water    ( 6947个结果
leetcode.11---------Container With Most Water
题目:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). ...
分类:其他好文   时间:2015-01-29 17:48:28    阅读次数:180
LeetCode --- 11. Container With Most Water
题目链接:Container With Most Water Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is ...
分类:其他好文   时间:2015-01-29 12:48:22    阅读次数:226
poj 1163 递归
#include #include //use recurrence way to find most biggest total using namespace std;int sum=0;void print_value(int a[][110],int N) //printf the numb...
分类:其他好文   时间:2015-01-29 12:24:11    阅读次数:188
(枚举+并查集) hdu 1598
find the most comfortable roadTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4096Accepted Submiss...
分类:其他好文   时间:2015-01-29 12:14:58    阅读次数:166
CDZSC_2015寒假新人(4)——搜索 H
Time Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uDescriptionHiking in the mountains is seldom an easy task for most people, as it is ...
分类:其他好文   时间:2015-01-28 17:28:12    阅读次数:173
Best Time to Buy and Sell Stock III
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. 注意 You may n...
分类:其他好文   时间:2015-01-28 14:47:27    阅读次数:197
小端法与大端法
For ordering the bytes representing an object, there are two common conventions. Consider a w-bit integer having a bit representation [xw-1, xw-2, ... , x1, x0 ], where xw-1 is the most significant...
分类:其他好文   时间:2015-01-28 13:09:28    阅读次数:169
Leetcode#11 Container With Most Water
原题地址最朴素的想法就是,枚举容器的左边界和右边界,总能找到解,不过时间复杂度是O(n^2)的。改进I:从左向右枚举左边界,在此基础上从右向左枚举右边界,一旦右边界高度>=左边界高度就可以停止枚举了,因为继续枚举下去找到的矩形肯定面积更小。比如下图,左边界在位置0,高度为height[0]=3,那么...
分类:其他好文   时间:2015-01-28 12:53:58    阅读次数:131
leetcode 159: Longest Substring with At Most Two Distinct Characters
Total Accepted: 1167 Total Submissions: 3961 Given a string, find the length of the longest substring T that contains at most 2 distinct characters. For example,Given s = “eceba”, T is...
分类:其他好文   时间:2015-01-28 06:15:59    阅读次数:149
map(int, ..) 与 int() 的区别
>>> map(int,'0')[0]>>> int('-1')-1>>> map(int, l[1])Traceback (most recent call last): File "", line 1, in ValueError: invalid literal for int() with....
分类:其他好文   时间:2015-01-28 06:08:44    阅读次数:369
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!