Skip to content

Instantly share code, notes, and snippets.

@Zibx
Zibx / waterfill
Last active Dec 27, 2015
Quest from twitter interview
View waterfill
var calculate = function( arr ){ // one cycle solution
var minMax,
sum = 0,
fullSum = 0,
el,
maxMax,
i, _i = arr.length - 1;
minMax = arr[0]; // first item is the current left max
maxMax = arr[_i]; // last item is the current right max
You can’t perform that action at this time.