aoc2023/day-15/one.go

19 lines
278 B
Go
Raw Normal View History

2023-12-15 17:19:33 +00:00
package main
import "strings"
var lenses = []string{}
// one returns the sum of all hashed values
func one(lines []string) int {
lenses = strings.Split(lines[0], ",")
hash := newHasher()
sum := 0
for _, lense := range lenses {
sum += hash.run(lense)
}
return sum
}