Skip to content

Instantly share code, notes, and snippets.

@irvingprog
Last active August 29, 2015 14:04
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 irvingprog/f959ef208fdd41198f4a to your computer and use it in GitHub Desktop.
Save irvingprog/f959ef208fdd41198f4a to your computer and use it in GitHub Desktop.
Hash reversed challenge to developer job position at Trello.com
#!/usr/bin/python
# -*- encoding: utf-8 -*-
#
# Copyright 2014 - Irving Prog
# License: LGPLv3 (see http://www.gnu.org/licenses/lgpl.html)
def hash_reversed(hash_):
LETTERS = 'acdegilmnoprstuw'
chars = []
while hash_ > 37:
for i, letter in enumerate(LETTERS):
if (hash_ - i) % 37 == 0:
chars.append(letter)
hash_ = (hash_ - i) / 37
break
return ''.join(reversed(chars))
def main():
hash_ = 910897038977002
print hash_reversed(hash_)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment