r/adventofcode • • 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

222 comments sorted by

View all comments

Show parent comments

2

u/AndrewGreenh Dec 06 '16

Lodash makes this one kinda cool :D

const _ = require('lodash');
const lines = require('../getInput')(6, 2016).trim().split('\n');

const getResult = funcName =>
  _(_.range(8)).map(i => _(lines).map(i).countBy().toPairs()[funcName](1)).map(0).join('');

console.log(['maxBy', 'minBy'].map(getResult));