Company: MediaNet_23july
Difficulty: medium
Rainwater Harvesting Problem Description Given an N x M matrix of positive integers representing the height of each unit cell in a 2D elevation map. Return the volume of water it is able to trap after raining. Input Format The first and the only argument given is the integer matrix A. Output Format Return the volume of water that is trapped after raining. Constraints 1 <= N, M <= 110 1 <= A[i] <= 19999 Examples Example 1: Input: A = [ [1, 4, 3, 1, 3, 2], [3, 2, 1, 3, 2, 4], [2, 3, 3, 2, 3, 1] ] Output: 4 Follow-up You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return the answer from the function. Check out Sample Codes for more details. int Solution::solve(vector<vector<int> > &A) { }