Last active
December 22, 2015 05:49
-
-
Save nikcorg/6426677 to your computer and use it in GitHub Desktop.
My solution to the problem at http://reaktor.fi/ura/fast_track/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (input) { | |
return [].reduce.call(input, function (mem, n, i) { | |
return mem[i % 5] = n, mem.push(Math.max(mem.pop(), eval(mem.join("*")))), mem; | |
}, [0, 0, 0, 0, 0, 0]).pop(); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (input) { | |
return [].reduce.call(input, function (max, n, i, seq) { | |
return Math.max(max, eval([].slice.call(seq, i, i + 5).join("*"))); | |
}, 0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (input) { | |
return _.reduce(input, function (max, n, i, seq) { | |
return Math.max(max, eval(_.head(_.tail(seq, i), 5).join("*"))); | |
}, 0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function (input) { | |
return _.max(_.map(input, function (n, i, seq) { | |
return eval(_.head(_.tail(seq, i), 5).join("*")); | |
})); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment