Skip to content

Instantly share code, notes, and snippets.

View Zibx's full-sized avatar
💭
Unicorning

Zibx Zibx

💭
Unicorning
View GitHub Profile
@Zibx
Zibx / waterfill
Last active December 27, 2015 00:09
Quest from twitter interview
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