Created
August 3, 2018 11:57
-
-
Save SneakyBrian/364278bc06642f0f87c4db854ac3de4f to your computer and use it in GitHub Desktop.
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
func calculateHouses(in string) int { | |
v := map[int]int{0: 1} | |
z := map[rune]int{'<': -1, '>': 1, '^': 99, 'v': -99} | |
x := 0 | |
for _, a := range in { | |
x += z[a] | |
v[x] = 1 | |
} | |
return len(v) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment