Skip to content

Instantly share code, notes, and snippets.

@SneakyBrian
Created August 3, 2018 11:57
Show Gist options
  • Save SneakyBrian/364278bc06642f0f87c4db854ac3de4f to your computer and use it in GitHub Desktop.
Save SneakyBrian/364278bc06642f0f87c4db854ac3de4f to your computer and use it in GitHub Desktop.
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