2024(5): pull in the second puzzle

This commit is contained in:
2024-12-19 12:08:38 +01:00
parent bfa968e7fa
commit 041fa92a26

View File

@ -84,3 +84,17 @@ These have middle page numbers of `61`, `53`, and `29` respectively. Adding thes
Of course, you'll need to be careful: the actual list of _page ordering rules_ is bigger and more complicated than the above example.
Determine which updates are already in the correct order. _What do you get if you add up the middle page number from those correctly-ordered updates?_
### Part Two
While the Elves get to work printing the correctly-ordered updates, you have a little time to fix the rest of them.
For each of the _incorrectly-ordered updates_, use the page ordering rules to put the page numbers in the right order. For the above example, here are the three incorrectly-ordered updates and their correct orderings:
* `75,97,47,61,53` becomes `97,75,47,61,53`.
* `61,13,29` becomes `61,29,13`.
* `97,13,75,29,47` becomes `97,75,47,29,13`.
After taking _only the incorrectly-ordered updates_ and ordering them correctly, their middle page numbers are `47`, `29`, and `47`. Adding these together produces _`123`_.
Find the updates which are not in the correct order. _What do you get if you add up the middle page numbers after correctly ordering just those updates?_