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 }