Last active
August 29, 2015 14:15
-
-
Save AbeEstrada/b7405447f6f2137c5269 to your computer and use it in GitHub Desktop.
Trello Node.js Developer Challenge - https://trello.com/jobs/developer
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
letters = "acdegilmnoprstuw" | |
hash = (s) -> | |
h = 7 | |
for l in s | |
h = (h * 37 + letters.indexOf(l)) | |
h | |
rhash = (h) -> | |
return rhash((h - (h % 37)) / 37) + letters[h % 37] if h > letters.length | |
return "" | |
s = "leepadg" | |
console.log hash(s) | |
console.log rhash(hash(s)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment