1
0
Fork 0

add 2024/day3

This commit is contained in:
Sebastian Mark 2024-12-03 09:02:16 +01:00
parent 02b95a7e65
commit a7c0239f66
4 changed files with 90 additions and 0 deletions

14
helper/convert.go Normal file
View file

@ -0,0 +1,14 @@
package helper
import (
"strconv"
)
func ToInt(s string) int {
i, _ := strconv.Atoi(s)
return i
}
func ToString(i int) string {
return strconv.Itoa(i)
}

View file

@ -51,3 +51,21 @@ func ReadLinesToIntSlices() (lines [][]int) {
return lines
}
func ReadLinesToStringSlices() (lines []string) {
scanner := getLines()
for scanner.Scan() {
lines = append(lines, scanner.Text())
}
return lines
}
func ReadLinesToString() (line string) {
scanner := getLines()
for scanner.Scan() {
line += scanner.Text()
}
return line
}