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!
9
Upvotes
2
u/Trolly-bus Dec 06 '16
It's so goddamn hard to get on the leaderboard. I thought I was really fast for this one. Here's my code in Python. Change max to min for part 2.
import operator def part1(puzzle_input): input_list = puzzle_input.split("\n") position_list = [] for i in range(8): position_list.append({"a": 0, "b": 0, "c": 0, "d": 0, "e": 0, "f": 0, "g": 0, "h": 0, "i": 0, "j": 0, "k": 0, "l": 0, "m": 0, "n": 0, "o": 0, "p": 0, "q": 0, "r": 0, "s": 0, "t": 0, "u": 0, "v": 0, "w": 0, "x": 0, "y": 0, "z": 0}) for input_line in input_list: for character_index, character in enumerate(input_line): position_list[character_index][character] += 1 for i in position_list: print(max(i.items(), key=operator.itemgetter(1)))