|All-time Popular Problems|
|Maximum difference between node and its ancestor|
|Count nodes of linked list|
|Find first set bit|
|Angle between hour and minute hand|
|Recursively remove all adjacent duplicates|
|Remove every k'th node|
|Merge Two Sorted Arrays|
|Spirally traversing a matrix|
|Merge two sorted linked lists|
|Longest 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