Skip to content

Instantly share code, notes, and snippets.

@thejhh
Last active December 22, 2015 15:28
Show Gist options
  • Select an option

  • Save thejhh/6492423 to your computer and use it in GitHub Desktop.

Select an option

Save thejhh/6492423 to your computer and use it in GitHub Desktop.
/* My Solution for http://reaktor.fi/ura/fast_track/ */
function test(input) {
return Math.max.apply(Math, input.split('').map(function(d, i, a) {
return (i+5 <= a.length) ? a.slice(i, i+5).reduce(function(p, c) { return p*c; }) : 0;
}));
}
// Test it
var util = require('util');
var input = "9173693186194181417738215175900016290272158783595850014893963482171394866697758104419752405360398051582082514651090435044774853665148525743706957144540632285501274283827208688006406835287910027401741332672857041504481079443769630520377569931394313316936203572829475518175578769949295843144886193986398935601684164301752469657228106950395141746586216096320639463094766281501027535721082362330321209824698119349281249106230960987514642193292740680918931980400950995051212978080251691148524608117606492764031796947882097963013601147696917487978782198601416585616777626109907663940396980550281557808655772037707102386830593289785580132500162790017737292491379442083179672092375771202156779940706558009958387184945945827343480221851427327776253913848726422670483607091587912589975530199726127069991573930448808534609625650703007360444774560077801179254302489468350171080700423035807815972755556467463832565822616029305395418210793104694781975192870308623855849139408658742038089313668620245315281946433239";
util.debug( util.inspect( test(input) ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment