Skip to content

Instantly share code, notes, and snippets.

@jjv
Created September 9, 2013 12:00
Show Gist options
  • Save jjv/6494657 to your computer and use it in GitHub Desktop.
Save jjv/6494657 to your computer and use it in GitHub Desktop.
function (input) {
return (
_.foldl(input, function(prevObj, char) {
var prev = prevObj.prev,
max = prevObj.max,
next = prev.substr(1) + char,
product = _.foldl(next, function(acc, num) {
return acc * num
})
return {max: (max > product ? max : product), prev: next }
}, {max: 0, prev: '00000'})
).max
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment