Anand won the #code-crunch on his second attempt! Anand had the best answer to the code-crunch on:
The input array representing a building blocks where the width of each block is 1, calculate how much water we can store in between the blocks.
Example 1: arr[] = [3, 1, 0,2]
Output: 3
Structure is like below:
|
| |
||_|
We can store 3 units of water in the middle gap.
Example 2: arr[] = [1, 0, 0, 2, 0, 4]
Output: 4
Structure is like below:
|
|
| |
|__|_|
We can store 4 units of water in the middle gap.