网址:https://leetcode.com/problems/container-with-most-water/
题意:
找两条纵深线,然后利用x坐标来计算容器面积.
分析:
先找最远的两头,然后往中间收缩,
长变小了,高变长才能使面积可能更大.
所以就是找更长的...
解法:
如果height[left]
反之,同理.
代码:
https://github.com/L...
分类:
其他好文 时间:
2015-05-18 16:43:02
阅读次数:
115
Rain on your Parade
Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 655350/165535 K (Java/Others)
Total Submission(s): 3033 Accepted Submission(s): 952
Problem Description
You’re gi...
分类:
编程语言 时间:
2015-05-17 00:52:31
阅读次数:
185
无脑写代码代码(TLE): 1 #include 2 #include 3 4 using namespace std; 5 6 int findLeft(int i, vector height) 7 { 8 int t = i-1; 9 while ((t+1= 0)10 ...
分类:
移动开发 时间:
2015-05-16 17:48:03
阅读次数:
179
Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.Fo...
分类:
移动开发 时间:
2015-05-14 18:08:31
阅读次数:
231
原文:http://www.cnblogs.com/rain-lei/p/3622057.html函数调用大家都不陌生,调用者向被调用者传递一些参数,然后执行被调用者的代码,最后被调用者向调用者返回结果,还有大家比较熟悉的一句话,就是函数调用是在栈上发生的,那么在计算机内部到底是如何实现的呢?对于程...
分类:
Web程序 时间:
2015-05-12 20:34:34
阅读次数:
109
题目描述:
Given a 2d grid map of '1's (land) and '0's
(water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. Y...
分类:
其他好文 时间:
2015-05-12 17:13:44
阅读次数:
124
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining....
分类:
移动开发 时间:
2015-05-12 01:25:09
阅读次数:
143
一串非负整数,和其序号构成数对(i,v[i]),每条垂直线段的两个端点由(i,0),(i,v[i])两个点构成,两条线段与x轴形成一个容器,求最大容器的储水量。(容器不能倾斜)【思路】1.O(n^2)法:即一个对角线为0的上三角矩阵,求每条线段与其后面的所有线段组成容器的容量(其实就是面积)。该法l...
分类:
其他好文 时间:
2015-05-11 10:39:45
阅读次数:
93
Can you make a water problem?Time Limit:2000/1000MS (Java/Others)Memory Limit:128000/64000KB (Java/Others)SubmitStatisticNext ProblemProblem Descripti...
分类:
其他好文 时间:
2015-05-10 00:57:08
阅读次数:
274
Problem:
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...
分类:
编程语言 时间:
2015-05-08 00:05:11
阅读次数:
129