The one dimensional twitter waterflow problem is this:
You are given an array that represents a hill in the sense that the ith entry is the height of the ith location of the hill. When it rains, water logs in the hills, and you need to figure out how much water would log.
For example, after raining, the array
2 5 3 4 3 2 5 5 3 4 2 2 2 looks like this,
and 9 units of water have accumulated.
The challenge is to solve the 2D version of this. To clarify, you will be given a 2D matrix of land heights, and you will have to output the total amount of rainwater it can collect. Water cannot flow out through diagonals, but only the four cardinal directions.