Solution to Flood-Depth by codility

25 Sep

Question: https://codility.com/demo/take-sample-test/flood_depth/

Question Name: Flood-Depth or FloodDepth

This is a variant of Trapping Rain Water by LeetCode. The undergoing concept is the same. However, the implementation is a bit different.

3 Replies to “Solution to Flood-Depth by codility

  1. I just want to point out that there is actually an O(N) time, O(1) space solution by using two pointers.

  2. I think my solution concept is easy

  3. Here is my solution and it passes all the tests. O(n) time complexity. And Simple!

Leave a Reply

Your email address will not be published. Required fields are marked *

Please put your code into a <pre>YOUR CODE</pre> section. Thanks and Happy Coding!