Given an array of non-negative integers representing terraces in an elevation map where the width of each bar is 1
, compute how much water it is able to trap after raining.
import { trappingWater } from "functional-algos";
console.log(trappingWater([3, 0, 0, 2, 0, 4])); // 10