Media.net On-Campus OA 2026 | Coding Assessment | Complete Solutions & Tips | 2D Arrays & Priority Queues | Campus Assessment

media.net · Question · Posted Apr 2026

Rainwater Harvesting Problem Statement: Given an N * 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. For Example Input 1:   A = [ [1, 4, 3, 1, 3, 2] [3, 2, 1, ...

The full answer & interview discussion are available to premium members.

Log in Create a free account