Skip to content

Instantly share code, notes, and snippets.

@maephisto
Created January 29, 2015 21:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maephisto/6ec1807b859dbcc0720f to your computer and use it in GitHub Desktop.
Save maephisto/6ec1807b859dbcc0720f to your computer and use it in GitHub Desktop.
Trello Javascript challenge solution
// what we're working with
var characterList = 'acdegilmnoprstuw';
// what we're going for
var theHashWeWereLookingFor = 956446786872726;
var theMagicString = '';
//Now reverse engineer
while (theHashWeWereLookingFor > 7 ) {
var counter = 0;
while (counter < characterList.length) {
if ((theHashWeWereLookingFor - counter) % 37 === 0) {
//Add character to the solution
theMagicString = (characterList[counter]) + theMagicString;
break;
}
counter ++;
}
theHashWeWereLookingFor = (theHashWeWereLookingFor - counter) / 37;
}
//This the solution we were looking for
//in just 50ms
console.log(theMagicString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment