Discussion thread for day 5 of the Advent of Code - https://adventofcode.com/2023/day/5
Brute force.
@gawa Nice work on this! By far the most elegant solution I've seen for this challenge.
My heart leapt out of my chest when I ran my first try of part 2 without looking how big the numbers were 😱 But handling the ranges of numbers ended up being a really interesting exercise. I feel like I probably could have used a macro for this, but with the number of steps, I went with brute-force.
At first I believed brutal force and finally getting the result as below. It was an epic failure.
Then moved to the Range comparing approach, with some hints from here, I got the answer and I decided to move on even I can not explain the logic in my flow.
Interesting thing is that I am still getting the incorrect answer when I use my input with the most of workflows uploaded here. 😁
So I guess its just something we can forget and leave behind and continue our life, continue to be tortured by Day 7 or Day xx. 😅 (Day 6, you are nice), continue to hope to retire to beach one day. @mceleavey
I was on the cusp of solving this one for... many many hours. @PangHC 's workflow looked most similar to my approach, so I ended up having to open that up to help me troubleshoot why I was getting the right answer on the sample data but not my prod data. It was super helpful - even though I was getting the right answer on the sample data, my approach was wrong, and Pang_Hee_Choy's mapping table helped me identify those issues. Thank you for your work!
While going the route of brute force may have gotten me to the answer faster I refused to give in and kept banging my head to get this to run efficiently. Ultimately I succeeded and got my overall run time down to 1.1 seconds.
Actually quite proud that I got the solution to part 2! Did have to start all over though as my approach to part 1 was the brute force kind.
Part two is done with a batch and iterative macro and takes less then 2 seconds!