From e3a47b0e166d23825e53dad58b73708d51a6fdef Mon Sep 17 00:00:00 2001 From: Kharec Date: Tue, 2 Dec 2025 22:13:31 +0100 Subject: [PATCH] feat: solve part two --- internal/2015/DayNine/code.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/internal/2015/DayNine/code.go b/internal/2015/DayNine/code.go index 399053e..62f6448 100644 --- a/internal/2015/DayNine/code.go +++ b/internal/2015/DayNine/code.go @@ -90,5 +90,17 @@ func PartOne(data []string) int { } func PartTwo(data []string) int { - return 0 + distances := buildDistanceMap(data) + cities := getCities(distances) + permutations := generatePermutations(cities) + + maximalDistance := 0 + for _, route := range permutations { + total := calculateRouteDistance(route, distances) + if total > maximalDistance { + maximalDistance = total + } + } + + return maximalDistance }