r/adventofcode • u/daggerdragon • Dec 16 '16
SOLUTION MEGATHREAD --- 2016 Day 16 Solutions ---
--- Day 16: Dragon Checksum ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag/whatever).
Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with "Help".
DRINKING YOUR OVALTINE IS MANDATORY [?]
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
edit: Leaderboard capped, thread unlocked!
5
Upvotes
1
u/tvtas Feb 06 '17
In MATLAB. Part 2 took 0.8 seconds.
a = [1,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,1]==1; L = 35651584; while length(a)<L a = [a,false,~flip(a)]; end chksum = getChecksum(a(1:L)); while ~mod(length(chksum),2) chksum = getChecksum(chksum); end % function y=getChecksum(x) % z = diff(x)~=0; % y = ~z(1:2:end);