Skip to content

Instantly share code, notes, and snippets.

@irvingprog
Created August 12, 2014 05:42
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/a7098069c401607dacab to your computer and use it in GitHub Desktop.
Save irvingprog/a7098069c401607dacab to your computer and use it in GitHub Desktop.
Hash reversed challenge to developer job position at Trello.com
package main
import ("fmt"
"strings")
func main() {
var letters string = "acdegilmnoprstuw"
var chars = []string{}
var hash int64 = 956446786872726
var reverse_chars = []string{}
for i := 1; i<10; i++ {
for i, char := range letters {
if int64((hash - int64(i))) % 37 == 0 {
chars = append(chars, string(char))
hash = int64((hash - int64(i))) / 37
break
}
}
}
for i:= len(chars)-1; i>=0 ;i-- {
reverse_chars = append(reverse_chars, string(chars[i]))
}
fmt.Println(strings.Join(reverse_chars, ""))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment