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
Trapping Rain WaterTotal Accepted:35650Total Submissions:118319My SubmissionsQuestionSolutionGivennnon-negative integers representing an elevation map...
分类:
移动开发 时间:
2015-05-07 00:26:02
阅读次数:
249
【题目】
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). Fin...
分类:
其他好文 时间:
2015-05-06 23:10:19
阅读次数:
391
Trapping Rain Water
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 ...
分类:
移动开发 时间:
2015-05-06 17:52:41
阅读次数:
142
加水印代码public Bitmap addWaterMark(Bitmap src, String water, Context context){
Bitmap tarBitmap = src.copy(Config.ARGB_8888, true);
int w = tarBitmap.getWidth();...
分类:
移动开发 时间:
2015-05-06 17:39:48
阅读次数:
147
Number of IslandsGiven 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 con...
分类:
其他好文 时间:
2015-05-06 10:51:49
阅读次数:
132
【题目】Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints...
分类:
其他好文 时间:
2015-05-05 18:28:41
阅读次数:
124
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. You may assume...
分类:
其他好文 时间:
2015-05-01 20:00:47
阅读次数:
136
问题分析
这道题目解题思路可以参考leetcode011:Container With Most Water 的分析,leetcode011是求围住的最大面积,这里有所区别,统计“装水”面积,还是从两边向中间扫描,时间复杂度O(n)。 这里设置一个水平面h,表示当前围住的高度,如果后续扫面到的比h低,说明可以装水,统计;如果比h高,更新h即可。...
分类:
移动开发 时间:
2015-04-30 16:14:21
阅读次数:
129
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-04-29 11:30:48
阅读次数:
132