Last active
August 29, 2015 14:08
-
-
Save alaingilbert/a5fbb4dbc55785232aff to your computer and use it in GitHub Desktop.
Trello dev challenge
This file contains hidden or 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
// Solution by Alain Gilbert | |
// https://trello.com/jobs/developer | |
var letters = 'acdegilmnoprstuw'; | |
var expected = 956446786872726; | |
var answer = ''; | |
for (var i = 9; i >= 0; i--) { | |
var mult = Math.pow(37, i); | |
var position = Math.floor(expected / mult); | |
expected -= mult * position; | |
answer += letters[position]; | |
} | |
console.log(answer.substr(1)); // trellises |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment