Skip to content

Commit

Permalink
Day 11: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
horothesun committed Sep 11, 2024
1 parent 1c7c51e commit ab4a8ab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/scala/Day11.scala
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,7 @@ object Day11:
as.toList.combinations(2).collect { case a1 :: a2 :: Nil => (a1, a2) }.toSet

def sumAllUniqueDistancesBetweenGalaxies(input: List[String]): Option[Long] = Image.parse(input).map { image =>
allUniquePairs(image.expanded.allGalaxies).toList.map((p1, p2) => p1.manhattanDistanceTo(p2)).sum
allUniquePairs(image.expanded.allGalaxies).toList
.map((p1, p2) => p1.manhattanDistanceTo(p2))
.sum
}

0 comments on commit ab4a8ab

Please sign in to comment.