You have as input an array of positive integer. Those integers represent the topological height of a landscape .
For instance, [3, 2, 1] is the following towers:
X
XX
XXX
It rains on the landscape, so all valleys get fill up. At the extremity of each side their are abyss where the rain fall down. You need to return an array with positive integer, where each value correspond to how many block of rain's water get fill up.
For the previous example, the answer is [0,0,0].
Other examples:
[3,1,3] => [0,2,0]
[3,1,2] => [0,1,0]