diff --git a/five.go b/five.go index 7354450..fe8ac5f 100644 --- a/five.go +++ b/five.go @@ -3,6 +3,7 @@ package main import ( "fmt" "io/ioutil" + "sort" "strings" ) @@ -18,6 +19,7 @@ func main() { d, _ := ioutil.ReadFile("in5.txt") s := strings.Split(string(d), "\n") max := 0 + var ids []int for _, code := range s { rowUpper := 127 rowLower := 0 @@ -55,9 +57,18 @@ func main() { } } id := row*8 + col + ids = append(ids, id) if id > max { max = id } } - fmt.Println(max) + sort.Ints(ids) + fmt.Println("Highest ID: ", max) + prev := 0 + for _, d := range ids { + if prev != 0 && prev+1 != d { + fmt.Println("Missing Seat: ", d-1) + } + prev = d + } }