Created
January 29, 2015 21:03
-
-
Save maephisto/6ec1807b859dbcc0720f to your computer and use it in GitHub Desktop.
Trello Javascript challenge solution
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
// 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