feat: solve part two
This commit is contained in:
1 parent
86370f27c8
commit
e3a47b0e16
1 file changed
+13
-1
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user