You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
324 B

package day09
import (
"log"
)
func Solve1() {
anomaly := 0
rangeSize := 25
if len(rows) == 20 {
rangeSize = 5
}
i := 0
for _, num := range rows[rangeSize:] {
if isSumOfPreviousNumbers(num, rows[i:i+rangeSize]) == false {
anomaly = num
}
i++
}
log.Printf("2020-12-09.01: Answer: %d\n", anomaly)
}