Skip to content

Commit

Permalink
chore: codacy onboarding round 2
Browse files Browse the repository at this point in the history
  • Loading branch information
GriceTurrble committed Jan 11, 2024
1 parent 4f97a1a commit 1619db7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions 2023/aoc2023/day07/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ And that's our answer! On to Part 2

The addition of Jokers as the `J` value has two implications:

- The `hand_type` classification of a set of cards will change based on the number of Jokers present.
- The sort key generated by `card_sort_str` needs to move `J` values *down* to sort hands correctly.
- The `hand_type` classification of a set of cards will change based on the number of Jokers present.
- The sort key generated by `card_sort_str` needs to move `J` values *down* to sort hands correctly.

The latter is a very simple change, moving `J` down to the first position and shuffling others around:

Expand Down Expand Up @@ -192,9 +192,9 @@ simplified.sort();

In this example, `simplified` will be `[1, 3]`. Considering how to score the 1 Joker, there are three possible outcomes:

- As a distinct card, `[1, 1, 3]`, creating "Three of a Kind" (type 4);
- Combined with the `T`, `[2, 3]`, creating "Full House" (type 5); OR
- Combined with the `5`s, `[1, 4]`, creating "Four of a Kind" (type 6).
- As a distinct card, `[1, 1, 3]`, creating "Three of a Kind" (type 4);
- Combined with the `T`, `[2, 3]`, creating "Full House" (type 5); OR
- Combined with the `5`s, `[1, 4]`, creating "Four of a Kind" (type 6).

Type 6 is the strongest hand possible, obtained by adding the Joker (`1`) to the highest count of cards in the set (`3`).

Expand Down
8 changes: 4 additions & 4 deletions 2023/aoc2023/day09/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Link: <https://adventofcode.com/2023/day/9>

I realized pretty quick on this one that a recursive solution would be easiest to achieve:

- Take a set of numbers as an input
- If those numbers are all 0, return 0
- Otherwise, produce the next set of numbers as a Vector by iterating through the input over the range of indices `0..length-1` (one less than the final index), pushing `nums[i+1] - nums[i]` into the new set.
- Finally, recurse with this new set of numbers, adding the result of the recursion to `nums[len-1]` (the final number in the input).
- Take a set of numbers as an input
- If those numbers are all 0, return 0
- Otherwise, produce the next set of numbers as a Vector by iterating through the input over the range of indices `0..length-1` (one less than the final index), pushing `nums[i+1] - nums[i]` into the new set.
- Finally, recurse with this new set of numbers, adding the result of the recursion to `nums[len-1]` (the final number in the input).

Do this for every line of input, total things up, and we have an answer.

Expand Down

0 comments on commit 1619db7

Please sign in to comment.