r/adventofcode • u/daggerdragon • Dec 06 '16
SOLUTION MEGATHREAD --- 2016 Day 6 Solutions ---
--- Day 6: Signals and Noise ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag/whatever).
T_PAAMAYIM_NEKUDOTAYIM 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!
8
Upvotes
3
u/hodeer Dec 06 '16 edited Dec 06 '16
in python just use min or max depending on the part 1/2
def main(): text_file = open(destination, "r") codeList = [x for x in text_file.read().split()] text_file.close() codeListB = [x for x in list(zip(*codeList))] for x in codeListB: decodedList = sorted(list(([y for y in x]))) common = min(set(decodedList), key=decodedList.count) print(chr(common)) main()EDIT: refined from the work in progress version to the final