Solution to the 2D rainfall/basin interview question