r/PowerShell • u/dantose • Dec 07 '25
Advent of Code Days 6 and 7
I'm still behind, but how's everyone else doing?
Squid math: Looks like a basic indexing one. Part 1 looks pretty straight forward
https://adventofcode.com/2025/day/6
Laser Beams: Another map type one, so I'll probably need some time to grumble about it.
3
Upvotes
1
u/dantose Dec 10 '25 edited Dec 10 '25
Day 6 part 1:
Poking at part 2 now
Part 2 was fighting with me. I couldn't get it to add to arrays sensibly, so ended up just outputting it all to a big pipe and iterating over that. It's not pretty, but it works.
1
u/dantose Dec 11 '25
Day 7, part 1:
It's giving me some errors, "Cannot index into a null array." but it still spits out the right number.
I'm trying to hash out how they get the sample result in part 2
1
u/Future-Remote-4630 Dec 09 '25
I'm not sure how to approach day 7 part 2. My thought was we needed some sort of binary tree to traverse, but it's really hammering my brain how to describe the nodes in pwsh vs a language that more literally implements by reference.
1
u/ConfidentDuck1 Dec 10 '25
No no no no, not gonna do that meme this time. Almost got me.
2
u/SrBlackVoid Dec 07 '25
I managed to get super-fast processing answers for Day 6 #2 (about a second) and both problems for Day 7 (about 50-80 ms).
The map handling on Day 7 is actually a lot easier than you think 😄