[LintCode] Trapping Rain Water 收集雨水

Posted Grandyang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[LintCode] 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.

技术分享

Example

Given [0,1,0,2,1,0,1,3,2,1,2,1], return 6.

Challenge 

O(n) time and O(1) memory

O(n) time and O(n) memory is also acceptable.

 

s

 

 

以上是关于[LintCode] Trapping Rain Water 收集雨水的主要内容,如果未能解决你的问题,请参考以下文章

Lintcode363 Trapping Rain Water solution 题解

Lintcode364 Trapping Rain Water II solution 题解

42. Trapping Rain Water

[LeetCode] 42. Trapping Rain Water

42. Trapping Rain Water *HARD*

LeetCode 42. Trapping Rain Water