Discussion thread for day 2 of the Advent of Code - https://adventofcode.com/2024/day/2
no macro. let see how many days challenge can solve without macro
I went down the rabbit hole with part 2!
Ignoring the bad res.
Part 1 was simple, but I got caught out where the total number of levels could be different for each record in the real data.
Part 2, I spend so long trying something based on what I had done in part one of identifying if each row was an increase or decrease on the previous, going with complex multirows. For example IF Decrease but previous row was an increase, change to increase if the next row - previous row is actually an increase <=3... But my brain wasn't working.
In the end went down the batch macro route, but also couldn't work out if I need a batch or iterative, so just hardcoded the logic of skipping layers and calculating if all increasing or all decreasing.
-
I solved it, but it is an uncool workflow.
Tool Golf for Part2 without Macro. Another fun of AoC is refining WF which I believed it was the best at that time.
lacks versatility
Continue Filter...
With a bit of thinking time I've come up with my attempt at tool golf.
Certainly won't be winning any awards for elegance but work calls and 2 stars = 2 stars. Definitely lured into a false sense of security yesterday!
Took a lot longer than yesterday, but I got there after I gave up refusing to use a macro on Day 2.
IF !IsEmpty([Concat_State]) && Contains([Concat_State], ",")
THEN REGEX_Replace([Concat_State], '(\b[^,]+)(?=.*, *\1(?:,|$)), *', '')
ELSE [Concat_State]
ENDIF
and the macro: