aoc2024/day-02/internal/two/util.go
onyx-and-iris a6295375aa remove internal/util
move cmpIncrease, cmpDecrease into parseLines
2025-01-07 17:19:24 +00:00

23 lines
297 B
Go

package two
import (
"strconv"
"strings"
)
func mustConv(s string) int {
n, err := strconv.Atoi(s)
if err != nil {
panic(err)
}
return n
}
func intsFromString(s string) []int {
nums := []int{}
for _, r := range strings.Fields(s) {
nums = append(nums, mustConv(r))
}
return nums
}