Skip to content

Instantly share code, notes, and snippets.

@pimeys
Created September 5, 2013 08:40
Show Gist options
  • Save pimeys/6447537 to your computer and use it in GitHub Desktop.
Save pimeys/6447537 to your computer and use it in GitHub Desktop.
function (input) {
var numbers_to_product = 5;
var max = 0;
for (var i = 0; i <= input.length - numbers_to_product; i++) {
var product = _.reduce(_.range(i, i + numbers_to_product), function(acc, j) {
return acc * parseInt(input[j]);
}, 1);
if (product > max) {
max = product;
}
}
return max;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment