Skip to content

Commit

Permalink
Optimize 2023 day 12 by skipping one recursive call
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Dec 12, 2023
1 parent dfec1ac commit 076e5c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/scala/eu/sim642/adventofcode2023/Day12.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object Day12 {
}
case ('#' :: _, _ :: _) => 0 // not enough length remaining
case ('?' :: newMask, lengths) => // recursively solve both cases
countArrangements('.' :: newMask, lengths) + countArrangements('#' :: newMask, lengths)
countArrangements(newMask, lengths) + countArrangements('#' :: newMask, lengths)
case (mask, lengths) => throw new IllegalArgumentException(s"impossible mask ($mask) and lengths ($lengths)")
}
})
Expand Down

0 comments on commit 076e5c0

Please sign in to comment.