refactor: standardize PartOne/PartTwo declarations
This commit is contained in:
1 parent
62969312e3
commit
3fb71d0cbf
4 files changed
+22
-24
No files matched your search
@@ -17,10 +17,10 @@ func ParseInput(filepath string) []string {
|
||||
return strings.Split(string(content), "\n")
|
||||
}
|
||||
|
||||
func PartOne(input []string) int {
|
||||
func PartOne(data []string) int {
|
||||
maxCalories, currentElf := 0, 0
|
||||
|
||||
for _, line := range input {
|
||||
for _, line := range data {
|
||||
if line == "" {
|
||||
maxCalories = max(maxCalories, currentElf)
|
||||
currentElf = 0
|
||||
@@ -33,11 +33,11 @@ func PartOne(input []string) int {
|
||||
return max(maxCalories, currentElf)
|
||||
}
|
||||
|
||||
func PartTwo(input []string) int {
|
||||
func PartTwo(data []string) int {
|
||||
var totals []int
|
||||
currentElf := 0
|
||||
|
||||
for _, line := range input {
|
||||
for _, line := range data {
|
||||
if line == "" {
|
||||
totals = append(totals, currentElf)
|
||||
currentElf = 0
|
||||
|
||||
Reference in new issue
Block a user