Discussion thread for day 6 of the Advent of Code - https://adventofcode.com/2022/day/6
@AkimasaKajitani neat solve! It reminded me of @AdamR_AYX 's solve from weekly challenge 59 about anagrams. I think you could apply similar logic here:
Tool golf edition. 2 tools each for parts 1 and 2, with just changing the number of characters to evaluate from 4 to 14. All of the processing can be done with a Generate Rows tool, and then a sample tool for the output.
I'll be honest this was a very lazy solution on my end (which I'm blaming on being ill). I initially used a multi row formula for star 1 and not wanting to do the same for star 2 I built a macro that works in essentially the same way
@estherb47 Cool RegEx solution! I wanted to write like this but I can't write like such a complex one.
This is the simplest regex I can think of for this. My 1st attempt was clunky with multirow formulas to get the stars. This is better I think.
Multi-row madness like many others
Wish I hadn't gotten such a late start on this one - it was a nice pick-me-up after Day 5! Excited to tool golf this one - I already have several ideas.
Back to a more gentle challenge today - but still a good excuse to learn some regex from some of our friends.
Dirty solution attached - pending refactor.
This solution's only redeeming feature is that it is parameterised rather than hard-coded into formulae - so the one answer will work for both parts.
- Then creates the window text string for that number of characters
- Then splits them into lines (one character per line)
- And checks if the count of characters for that starting position = the distinct count (i.e. if there are duplicates)
- And it picks the row with the lowest starting position which meets the condition.
Setting aside Day 5 problem...
Here's my solution for Day 6.