Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
encse authored Dec 7, 2024
1 parent ae7a5ad commit 6949544
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions 2024/Day07/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ You ask how long it'll take; the engineers tell you that it only needs final cal

Read the [full puzzle](https://adventofcode.com/2024/day/7).

It's time to pull out the recursion guns. I introduced a checker logic that go through the numbers in one line of input and tries all possible operators on the accumulated result to reach the target.
It's time to pull out the recursion guns. I introduced a checker logic that goes through the numbers in one line of input and tries all possible operators on the accumulated result to reach the target.

The common logic that parses the input and executes the checker was extracted into a single `Solve` function, but I found it more readable to have distinct checkers for the two parts of the problem. Everything runs in about a second, but since it's just a single line, I added an optimization in `Check2` to exit early when the accumulated result exceeds the target.
The common logic that parses the input and executes the checker was extracted into a single `Solve` function, but I found it more readable to have distinct checkers for the two parts of the problem.

Everything runs in about a second, but since it's just a single line, I couldn't stand and added an optimization in `Check2` to exit early when the accumulated result exceeds the target.

0 comments on commit 6949544

Please sign in to comment.