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.
 
 
 

28 lines
467 B

package day01
import (
"log"
"sort"
"strconv"
"git.elis.nu/etu/aoc2020/utils"
)
var rows []int
func ParseFile(input string) {
// Parse file
for _, line := range utils.GetLinesFromFile("day01/" + input + ".txt") {
row, err := strconv.Atoi(line)
if err != nil {
log.Println("Failed to parse int, skipping:", err)
continue
}
rows = append(rows, row)
}
// To reach the end state in a more consistent manner, sort the input
sort.Ints(rows)
}