package main import ( "fmt" "internal/day04" "internal/util" ) func main() { data := util.ReadInput() shifts := day04.ParseInput(data) guards := day04.BuildGuards(shifts) sleepiest, sleepiestMinute := FindSleepiestData(guards) fmt.Printf("Sleepiest Guard: %d\n", sleepiest.ID) fmt.Printf("Sleepiest Minute: %d\n", sleepiestMinute) fmt.Printf("Result: %d\n", sleepiest.ID*sleepiestMinute) } func FindSleepiestData(data map[int]*day04.Guard) (*day04.Guard, int) { var sleepiest *day04.Guard var minute, value int for _, guard := range data { for i := 0; i < 60; i++ { if guard.Sleep[i] > value { sleepiest = guard minute = i value = guard.Sleep[i] } } } return sleepiest, minute }