|
@@ -8,16 +8,22 @@ import (
|
|
"strconv"
|
|
"strconv"
|
|
)
|
|
)
|
|
|
|
|
|
-func readInput(file *os.File) []int {
|
|
|
|
|
|
+func readInput(file *os.File) ([]int, int) {
|
|
scanner := bufio.NewScanner(file)
|
|
scanner := bufio.NewScanner(file)
|
|
numbers := []int{0}
|
|
numbers := []int{0}
|
|
index := 0
|
|
index := 0
|
|
|
|
+ max := 0
|
|
|
|
|
|
for scanner.Scan() {
|
|
for scanner.Scan() {
|
|
line := scanner.Text()
|
|
line := scanner.Text()
|
|
if line == "" {
|
|
if line == "" {
|
|
|
|
+ if numbers[index] > max {
|
|
|
|
+ max = numbers[index]
|
|
|
|
+ }
|
|
|
|
+
|
|
index++
|
|
index++
|
|
numbers = append(numbers, 0)
|
|
numbers = append(numbers, 0)
|
|
|
|
+
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
|
|
|
|
@@ -28,7 +34,7 @@ func readInput(file *os.File) []int {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- return numbers
|
|
|
|
|
|
+ return numbers, max
|
|
}
|
|
}
|
|
|
|
|
|
func main() {
|
|
func main() {
|
|
@@ -43,6 +49,6 @@ func main() {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- numbers := readInput(file)
|
|
|
|
- fmt.Println(numbers)
|
|
|
|
|
|
+ _, max := readInput(file)
|
|
|
|
+ fmt.Println("Part1:", max)
|
|
}
|
|
}
|