Discussion thread for day 10 of the Advent of Code : https://adventofcode.com/2020/day/10
Well that made my head hurt, drew a few diagrams on paper and tried a few bits out in alteryx but no dice for part 2. Keen to see how it was possible!
Don't think you can brute force part 2... so a little thinking beforehand.
If you want the inner trick for part 2:
Struggled with Part 2, and found help on the adventofcode subreddit. Immediately tried to brute force it until I noticed the 'trillions'
Day 10!
Part1 was very easy. But Part 2 is.... I couldn't have Iterative approach.My approach is calculating Combination Numbers. It is similar to @OllieClarke 's approach.
I tried to make all pattern, but it was failed.And then, I try to calculate combination numbers.
As anonymous user #1105310
Revisited part 2 after some reddit research and the hint from @jdunkerly
-- A nice explainer here https://www.reddit.com/r/adventofcode/comments/ka9pc3/2020_day_10_part_2_suspicious_factorisation/
Still feels a little shonky though as it wouldn't automatically handle longer chains of 1's up to a 3.I went through a few different approaches in the disabled container but got lost until seeking help on the maths/logic.
Day 10 part A felt more like a day 1 question.
Still working on Part 2, I am currently stuck down a rabbit hole of thinking there is a brute force binary solution to it by trying to generate a series of 1,0s between record 1 and 104 to act as a T|F flag and then to run my multi row. However that's too big, so trying to slim it down by spotting patterns, for example I know my start and end are fixed. and there are repeating 1,1,3 and 1,1,1,3s and know from experience with some of the previous AoCs now looking for patterns.
Finally got there with the second part.
Took the idea of finding the patterns using regexcountmatch and then unwinding the fact that 3,1,1 appears in 3,1,1,1. It did mean to get the right answer I needed to hard code for sole 1,1 which occurs at the start of my workflow.
My solution was very similar to that of @jdunkerley79
Mine is similar to others.
This was much less of a programming problem and more of a maths problem. And **bleep** all of my UK friends for making me add the s to math! Anyway - super fun problem.
A little hint that isn't obvious at all looking at it at all - there is binary involved again!
Non macro solution. Thanks @jdunkerley79 for the hint to part 2.
Continuing with my Amp exploration from yesterday, this solution runs slower in the Amp engine(0.8s) vs the original(0.3s). It probably has to do with the trade off between the overhead in analyzing the workflow for parallel processing and the speed increase gained. Since there are very few rows in the input data, the overhead vastly outweighs the performance gains. To investigate this more, I added a generate rows tool to the start to see where potential performance gains begin. In this very linear workflow, AMP starts to show benefits once the input consists of about 3.5M rows.
Dan
This took me back to math theory and patterns from college. What was hanging me up on part b is I was trying to apply the pattern below "1113" (count ones = 3). At and above that it is:
Went the macro route because I couldn't think the non-macro way for part II. Should work for random jolt diff (of 2 or longer) or as well. The main limitation I see is the number of steps between the checkpoints should not be massive (or the iterative could be heavy, it's ok for the current dataset).
Is it cheating that I had to read through the reddit too to understand the trick of part two?Still macro-less on the challenges....
I couldn't have done it without @jdunkerley79 hint. You truly are impressive !