Calculate trapped rainwater between building heights represented as an array (Two-pointer elevation logic).
Difficulty: Hard
Phase: 6 · Mixed Logical Challenges
XP Reward: 30 XP
Topics: Mixed Logical Challenges, Hard
Supported Languages: Python, JavaScript, C, C++, Java
Problem Description
Given array of N non-negative integers representing elevation map, compute total trapped rainwater. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).
Constraints
- -10^9 <= N <= 10^9
Examples
Example 1
Input: 6 0 1 0 2 1 3
Output: 2
Explanation: Sample execution for input 6 0 1 0 2 1 3