Skip to content

Latest commit

 

History

History

trapping-water

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Trapping Rain Water Problem

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.

Usage

import { trappingWater } from "functional-algos";

console.log(trappingWater([3, 0, 0, 2, 0, 4])); // 10