We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 625c586 commit 785119dCopy full SHA for 785119d
docs/2023/puzzles/day22.md
@@ -188,10 +188,9 @@ for disintegration:
188
189
```scala 3
190
def getDisintegrableBricks(brickToSupportingBricks: Map[Brick, Set[Brick]]): Set[Brick] = {
191
- val nonDisintegrableBricks = brickToSupportingBricks.collect {
192
- case singleton if singleton.sizeIs == 1 =>
193
- // the only brick that holds the brick above
194
- singleton.head
+ val nonDisintegrableBricks = brickToSupportingBricks.values.collect {
+ case supporting if supporting.sizeIs == 1
+ supporting.head // the only brick that holds the brick above
195
}.toSet
196
brickToSupportingBricks.keySet diff nonDisintegrableBricks
197
}
0 commit comments