From 80f1462985c8f8613ff7007bdf7c652917feb0d5 Mon Sep 17 00:00:00 2001 From: Kharec Date: Mon, 22 Dec 2025 10:28:59 +0100 Subject: [PATCH] feat: solve part two --- internal/2017/DayTwo/code.go | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/internal/2017/DayTwo/code.go b/internal/2017/DayTwo/code.go index 18a47c8..e2009a1 100644 --- a/internal/2017/DayTwo/code.go +++ b/internal/2017/DayTwo/code.go @@ -47,5 +47,25 @@ func PartOne(data [][]int) int { } func PartTwo(data [][]int) int { - return 0 + sum := 0 + for _, row := range data { + found := false + for idx, first := range row { + for _, second := range row[idx+1:] { + max, min := first, second + if first < second { + max, min = second, first + } + if min != 0 && max%min == 0 { + sum += max / min + found = true + break + } + } + if found { + break + } + } + } + return sum }