|All-time Popular Problems|
|Minimum Depth of a Binary Tree|
|Even and odd elements at even and odd positions|
|Egg Dropping Puzzle|
|Find first set bit|
|Recursively remove all adjacent duplicates|
|Queue using two Stacks|
|Find the Odd Occurence|
|Longest Palindrome in a String|
|Maximum sum increasing subsequence|
Given n non-negative integers in array representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
2 0 2
Structure is like below
We can trap 2 units of water in the middle gap.
Below is another example.
The first line of input contains an integer T denoting the number of test cases. The description of T test cases follows.
Each test case contains an integer N followed by N numbers to be stored in array.
Print trap units of water in the middle gap.
7 4 0 9
6 9 9