https://oj.leetcode.com/problems/container-with-most-water/Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai...
分类:
其他好文 时间:
2015-02-03 20:55:30
阅读次数:
132
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-02-02 17:34:58
阅读次数:
282
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-02-02 14:04:12
阅读次数:
196
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.
For example,
Given [0,1,0,2,1,0,1,3,2,1,2,1],...
分类:
移动开发 时间:
2015-02-01 17:48:15
阅读次数:
191
Problem Description
Caocao was defeated by Zhuge Liang and Zhou Yu in the battle of Chibi. But he wouldn't give up. Caocao's army still was not good at water battles, so he came up with another ide...
分类:
其他好文 时间:
2015-01-29 21:10:54
阅读次数:
207
题目: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
题目链接: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
原题地址最朴素的想法就是,枚举容器的左边界和右边界,总能找到解,不过时间复杂度是O(n^2)的。改进I:从左向右枚举左边界,在此基础上从右向左枚举右边界,一旦右边界高度>=左边界高度就可以停止枚举了,因为继续枚举下去找到的矩形肯定面积更小。比如下图,左边界在位置0,高度为height[0]=3,那么...
分类:
其他好文 时间:
2015-01-28 12:53:58
阅读次数:
131
题目地址:POJ 3185
醉了。,。高斯消元这种题样例都不过的时候怎么调试好。。。干瞪着看了半天代码终于发现是一个符合写错了。。
这题同样是高斯消元+自由元枚举。没什么好说的。
代码如下:
#include
#include
#include
#include
#include
#include
#include
#include
#in...
分类:
其他好文 时间:
2015-01-27 18:27:11
阅读次数:
209
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-01-27 14:45:03
阅读次数:
167