题目:
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...
分类:
移动开发 时间:
2015-02-04 13:08:10
阅读次数:
256
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
http://kingj.iteye.com/blog/1555017http://www.cnblogs.com/rain-lei/p/3622057.html当调用(call)一个函数时,主调函数将声明中的参数表以逆序压栈,然后将当前的代码执行指针(eip)压栈,跳转到被调函数的入口点。 进入被...
分类:
其他好文 时间:
2015-01-30 22:34:09
阅读次数:
219
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