Finish day 5
This commit is contained in:
parent
04f29cdb4d
commit
b8cd01b914
|
@ -42,5 +42,16 @@ func main() {
|
||||||
fmt.Println("Highest Seat Number:", max)
|
fmt.Println("Highest Seat Number:", max)
|
||||||
case "2":
|
case "2":
|
||||||
// build a map of all seat numbers then just print the ones between 0 and 1024 that don't exist
|
// build a map of all seat numbers then just print the ones between 0 and 1024 that don't exist
|
||||||
|
seatMap := make(map[int]bool)
|
||||||
|
for _, line := range values {
|
||||||
|
seatNumber := calculateSeatNumber(line)
|
||||||
|
seatMap[seatNumber] = true
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < 1024; i++ {
|
||||||
|
if _, ok := seatMap[i]; !ok {
|
||||||
|
fmt.Println("Didn't find seat ", i)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user