mirror of
https://github.com/onyx-and-iris/aoc2024.git
synced 2025-01-09 22:30:47 +00:00
23 lines
297 B
Go
23 lines
297 B
Go
package one
|
|
|
|
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
|
|
}
|