Compare commits

...

1 Commits

Author SHA1 Message Date
b4db9ef306 fastest map version 2021-12-05 14:31:28 -05:00

View File

@ -42,12 +42,12 @@ type point struct {
}
type grid struct {
m map[point]int
m map[int]int
}
func (g *grid) AddLine(start, end point, includeHorizontal bool) {
for _, p := range LineFromPoints(start, end, includeHorizontal) {
g.m[p]++
g.m[p.x+p.y*1000]++
}
}
@ -109,7 +109,7 @@ func partOne() {
scanner := makeScanner(false)
grid := &grid{
m: map[point]int{},
m: make(map[int]int, 1000),
}
for scanner.Scan() {
line := scanner.Text()
@ -129,7 +129,7 @@ func partTwo() {
scanner := makeScanner(false)
grid := &grid{
m: map[point]int{},
m: make(map[int]int, 1000),
}
for scanner.Scan() {
line := scanner.Text()