r/PowerShell • u/dantose • Dec 04 '25
Advent of code day 3 and 4
Got a bit busy yesterday. I'm currently working on day 3 part 2. How's everyone else coming?
If you don't know what' I'm talking about, it's a coding challenge that runs every december.
11
Upvotes
View all comments
Show parent comment
1
u/Future-Remote-4630 Dec 05 '25
~2 minutes or so, which I was shocked by. The more time I spent, the more of the optimizations I had to remove to get the dang thing to work. I figured at O(N^2) it would have been a nightmare, so I must have either gotten lucky with the dataset or they intentionally have it set up to only require a handful of extra loops to get the new rolls.
My gut says there is probably a really clean solution using matrices and some math, but I've never even started down that road in powershell so I just threw together what I thought would work in concept.