Discussion thread for day 6 of the Advent of Code - https://adventofcode.com/2023/day/6
My solution.
Today's one is much easier than yesterday.
Simple, elegant, and very enjoyable to solve!
How nice and easy compared to day 5.
I could finish Day6 before the sunset unlike yesterday.
My solution
Another way to solve it in algebra way
Done.
I was freaking out by Day 5 Part 2, still can not figure it out
So I took the most possible complicated way for Part 1 today by building Macro inside macro and forward and backward apparoach, preparing the impact Part 2. but....the part 2 of today is just cute. 😁
Did some prep work on the input as well since I was too lazy to copy each record one by one....
with one tool change for part 2. time to use detour. haha.
Day 6 done to give a nice little serotonin boost after yesterday's part 2 breakdown! Not winning tool golf with this one but 2 stars = 2 stars.
Not a pretty solution, but a simple one
started out thinking to solve this using a quadratic formula like @CoG - but it turns out that the brue-force method runs in just a few seconds anyway, so rather spend extra time finishing Day 5...
I will go back and take a look at how others have solve this thought - just for learning.
Nice easy one. Thankfully!
Team brute force! 17 seconds to generate 60m records
So glad today was easy!
Had to tap into my 8th grade math for this one... It's been a while since I've dealt with parabolas...
Total_distance = hold_ms * (total_ms - hold_ms)9 < hold_ms * (7-hold_ms)9 < 7 * hold_ms - hold_ms^20 < 7 * hold_ms - hold_ms^2 - 90< -hold_ms^2 +7hold_ms - 9
x = (7 +- Sqrt( 7**2 - 4*-1*-9)) / 2*-1x = (7 +- sqrt( 49 - 36)) / -2x = (7 +- 3.6) / -2x = (-10.6 or -3.4)/ -23.4/2 < x < 10.6/21.7 < x < 5.3
I'm going to take the ceiling (round up) for dist_a and Floor for dist_b after adding a slight edge (+.00001 to dist_a and -.00001 to dist_b) to BEAT the record (since the quadratic formula solves to equals)
Then, I'll subtract the two numbers and add 1 (to include the first number which isn't counted when subtracting).
Day 5 pt 2 still to come after last night's fiasco. Good to have a nice one again
#TeamBruteForce
@cgoodman3 obvs different hardware, but my brute force runs in 28 seconds
After Day 5 mistreated me badly (mostly due to my own incompetence), today was like a big cosy hug made of clouds.
M.
Quite easy today. I did type the table up into a Text Input, to make it easier.
@cgoodman3 I had the same thought process when tackling this. Took 30 seconds to run
Kickin' it 8th grade-style with a little quadratic formula (after the long way in part 1)!
Solved! For Part 2, I initially used my Part 1 brute force solution. I then redid it using the quadratic formula (complete with singing the song to myself for the formula 🤓)
I needed this.
Day 6: I was lazy and solved Part 1 with generate rows... but Part 2 demanded that I reach into the dark recesses of my memory and resurrect the quadratic formula song I learned in 8th grade algebra. (Was much easier than yesterday, at least for me!)
My Designer Cloud solution. I solved it using a quadratic equation for Designer Cloud.
But Designer Cloud version has some problems.
- No SQRT function
- When the New Column Names changes at Cross Tab tool, we need to reset manually.
For SQRT function, I make the matching table between Pre SQRT and after SQRT which I made them in Designer Desktop.