Unable to load image

rDrama Advent of Code Day 7: 25% Edition

Advent of Code is an annual Christmas themed coding challenge that runs from December 1st until christmas. Each day the coding problems get progressively harder. We have a leaderboard and pretty good turnout, so feel free to hop in at any time and show your stuff!

Whether you have a single line monstrosity or a beautiful phone book sized stack of OOP code, you can export it in a nice little image for sharing at https://carbon.vercel.app

What did you think about today's problem?

https://adventofcode.com/2023

Our Code is 2416137-393b284c (No need to share your profile, you have the option to join anonymously if you don't want us to see your github)

38
Jump in the discussion.

No email address required.

Had part 2 really fast at 99% but missed the edge case where my "most frequent" function would return the joker sometimes and then the joker wouldn't get assigned to the actual most frequent letter :marseyrope:

Using linqs "List.Distinct()" operator gets you 90% of the way there as long as you can design a switch case for the result with the right precedence tbh

  • 1 distinct value is always 5 of a kind

  • 2 distinct is 4 of a kind if the first character has 1 or 4 occurances, otherwise it's a full house

Etc etc

If you have a joker you just decrement the distinct count and add all the jokers to the next most common card

Then cover the edge cases

Create a hand class and overload the compareto operator and then sort each type of hand using it.

(Don't have my code please enjoy my textual description)

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.