class Solution(object): def trap(self,nums): leftmosthigh = [0 for i in range(len(nums))] leftmax=0 for i in range(len(nums))...
分类:
移动开发 时间:
2015-12-24 23:55:03
阅读次数:
1432
问题:给定 n 个元素的数组 a1,a2..an,他们对应坐标中的 n 条线,第 i 条线的两端分别为坐标 (i, 0) 和 (i, ai)。求两根线,这两个线和 x 轴形成的容器能装最多的水。 这是一道直方图相关的题目,同样是直方图的题目还有:Trapping Rain Water 和 Larg...
分类:
其他好文 时间:
2015-12-23 01:50:01
阅读次数:
205
Time Limit: 6000/3000 MS (Java/Others)Memory Limit: 655350/165535 K (Java/Others)Total Submission(s): 3359Accepted Submission(s): 1083Problem Descript...
分类:
编程语言 时间:
2015-12-20 23:47:05
阅读次数:
297
(前面的话:启发式方法这本书里说过,问题不应该提在预设或学习的理论下,而应该是一个孤立的题,由人去分析和决定用到什么方法和知识。)来自可汗公开课:The average male drinks 2L of water when active outdoors(with a standard devi...
分类:
其他好文 时间:
2015-12-20 14:26:19
阅读次数:
272
public function addall(){ $Water = M('Waterrate'); $config = array( 'maxSize' => 0, 'root...
分类:
Web程序 时间:
2015-12-17 19:07:01
阅读次数:
168
42、Trapping Rain Water题目这道题目参考http://www.cnblogs.com/felixfang/p/3713197.html观察下就可以发现被水填满后的形状是先升后降的塔形,因此,先遍历一遍找到塔顶,然后分别从两边开始,往塔顶所在位置遍历,水位只会增高不会减小,且一直和...
分类:
其他好文 时间:
2015-12-17 15:43:28
阅读次数:
120
题目: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 en...
分类:
其他好文 时间:
2015-12-15 14:04:01
阅读次数:
153
题目来源https://leetcode.com/problems/trapping-rain-water/Givennnon-negative integers representing an elevation map where the width of each bar is 1, comp...
分类:
移动开发 时间:
2015-12-13 17:06:18
阅读次数:
179
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 ...
分类:
其他好文 时间:
2015-12-13 14:02:57
阅读次数:
169
Container With Most WaterGiven n non-negative integers a1, a2, ..., an, where each represents a point at coordinate(i, ai).nvertical lines are drawn s...
分类:
其他好文 时间:
2015-12-09 19:30:26
阅读次数:
143