rDrama Advent of Code Day 6 Discussion Thread

Not sure where @RedNose is so I'll just post this. Post ur solutions below or whatever idc

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)

50
Jump in the discussion.

No email address required.

There's also the analytic solution, where t is the race time and d is the race distance.

https://i.rdrama.net/images/1701845122547258.webp

Jump in the discussion.

No email address required.

Huge pain in the butt that some roots are ints so you can't just round. Guessing this is where they expected to trip people up.

Jump in the discussion.

No email address required.

yeah I did this first and considered not even writing the code for it lol

I shouldn't have waited until I got home to start I could have done this on a notepad

Jump in the discussion.

No email address required.

If you didn't feel like remembering how to do math, you could also recognize that the winning numbers are always a parabola with the highest point in the center, then just divide the time by 2 and test backwards until it isn't big enough anymore, then multiply the result by 2.

Jump in the discussion.

No email address required.

I mean just brute forcing it took less than a second on my shitty laptop.

Jump in the discussion.

No email address required.

Cancel your negatives, please

Jump in the discussion.

No email address required.

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