问题分析
这道题目解题思路可以参考leetcode011:Container With Most Water 的分析,leetcode011是求围住的最大面积,这里有所区别,统计“装水”面积,还是从两边向中间扫描,时间复杂度O(n)。 这里设置一个水平面h,表示当前围住的高度,如果后续扫面到的比h低,说明可以装水,统计;如果比h高,更新h即可。...
分类:
移动开发 时间:
2015-04-30 16:14:21
阅读次数:
129
题目: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...
分类:
移动开发 时间:
2015-04-26 10:49:01
阅读次数:
135
Title: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 rain...
分类:
移动开发 时间:
2015-04-23 15:33:03
阅读次数:
177
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-04-20 09:23:52
阅读次数:
238
题目: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...
分类:
移动开发 时间:
2015-04-17 23:51:07
阅读次数:
163
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-04-15 16:50:03
阅读次数:
117
感觉和Container With Most Water很像,这里有个问题,如果让球最大的坑,怎么做呢?还有candy那道题,好像都是这种双扫系列的refhttp://fisherlei.blogspot.com/2013/01/leetcode-trapping-rain-water.html双扫...
分类:
移动开发 时间:
2015-04-10 13:00:09
阅读次数:
153
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-04-09 15:09:04
阅读次数:
172
题目链接:trapping-rain-water
import java.util.Stack;
/**
*
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...
分类:
移动开发 时间:
2015-03-27 22:22:39
阅读次数:
158
https://leetcode.com/problems/trapping-rain-water/Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute ...
分类:
移动开发 时间:
2015-03-20 23:31:14
阅读次数:
204