Discussion thread for day 4 of the Advent of Code - https://adventofcode.com/2023/day/4
My solution.
Part 1 was very easy. But it took so much time for part 2 because I didn't understand the question correctly and wasted my time. But I am satisfied in the execution time(less than 1 sec).
My first macro in AoC. Definitely learned a bit from the challenge today.
No luck with a non-macro solution... tried doing a many-to-many join but the idea fell flat. Would love to see a different appraoch.
non-macro version.
I just random test and boom, hit the result.
1+
iif([Row-1:Sum_match]>0,[Row-1:Count2],0)+
iif([Row-2:Sum_match]>1,[Row-2:Count2],0)+
iif([Row-3:Sum_match]>2,[Row-3:Count2],0)+
iif([Row-4:Sum_match]>3,[Row-4:Count2],0)+
iif([Row-5:Sum_match]>4,[Row-5:Count2],0)+
iif([Row-6:Sum_match]>5,[Row-6:Count2],0)+
iif([Row-7:Sum_match]>6,[Row-7:Count2],0)+
iif([Row-8:Sum_match]>7,[Row-8:Count2],0)+
iif([Row-9:Sum_match]>8,[Row-9:Count2],0)+
iif([Row-10:Sum_match]>9,[Row-10:Count2],0)
Day 4 done and dusted! Took me a little while to debug my part 2 macro but we got there in the end!
Perfect use case for a simple iterative macro - I feel good getting this one done quickly after I was a mess on yesterday's puzzle!