Leet Code 42:- Trapping rain water solution

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining. Here we have to calculate the total trapped water area under this blocks. To solve this problem, best approach is to use the double counter. Will start from each end…