aoc2024/day-02/internal/two/util.go

23 lines
297 B
Go
Raw Normal View History

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
}