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.
26 lines
345 B
26 lines
345 B
package day09
|
|
|
|
import (
|
|
"log"
|
|
)
|
|
|
|
func Solve2() {
|
|
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.02: Answer: %d\n", findAnomalySum(anomaly, rows))
|
|
}
|