package main // two returns the sum of all shortest distances between galaxies if space expand by a factor of 1000000 func two(lines []string) int { compared := [][]int{} sum := 0 for i := range galaxies { for j := range galaxies { if i == j || inCompared(i, j, compared) { continue } dist := shortestRoute(galaxies[i].coords, galaxies[j].coords, 1000000) compared = append(compared, []int{galaxies[i].identifier, galaxies[j].identifier}) sum += dist } } return sum }