adventofcode/2016/day06/problem

75 lines
2.5 KiB
Plaintext
Raw Permalink Normal View History

2016-12-06 13:06:52 +00:00
Advent of Code
--- Day 6: Signals and Noise ---
2018-03-15 16:24:23 +00:00
Something is jamming your communications with Santa. Fortunately, your
signal is only partially jammed, and protocol in situations like this is to
switch to a simple repetition code to get the message through.
2016-12-06 13:06:52 +00:00
2018-03-15 16:24:23 +00:00
In this model, the same message is sent repeatedly. You've recorded the
repeating message signal (your puzzle input), but the data seems quite
corrupted - almost too badly to recover. Almost.
2016-12-06 13:06:52 +00:00
2018-03-15 16:24:23 +00:00
All you need to do is figure out which character is most frequent for each
position. For example, suppose you had recorded the following messages:
2016-12-06 13:06:52 +00:00
eedadn
drvtee
eandsr
raavrd
atevrs
tsrnev
sdttsa
rasrtv
nssdts
ntnada
svetve
tesnvt
vntsnd
vrdear
dvrsen
enarar
2018-03-15 16:24:23 +00:00
The most common character in the first column is e; in the second, a; in the
third, s, and so on. Combining these characters returns the error-corrected
2016-12-06 13:06:52 +00:00
message, easter.
2018-03-15 16:24:23 +00:00
Given the recording in your puzzle input, what is the error-corrected
version of the message being sent?
2016-12-06 13:06:52 +00:00
2018-03-15 16:24:23 +00:00
Your puzzle answer was cyxeoccr.
2016-12-06 13:06:52 +00:00
--- Part Two ---
Of course, that would be the message - if you hadn't agreed to use a modified repetition code instead.
In this modified code, the sender instead transmits what looks like random data, but for each character, the character they actually want to send is
slightly less likely than the others. Even after signal-jamming noise, you can look at the letter distributions in each column and choose the least common
letter to reconstruct the original message.
In the above example, the least common character in the first column is a; in the second, d, and so on. Repeating this process for the remaining characters
produces the original message, advent.
Given the recording in your puzzle input and this new decoding methodology, what is the original message that Santa is trying to send?
2018-03-15 16:24:23 +00:00
Your puzzle answer was batwpask.
2016-12-06 13:06:52 +00:00
References
Visible links
. http://adventofcode.com/
. http://adventofcode.com/2016/about
. http://adventofcode.com/2016/support
. http://adventofcode.com/2016/events
. http://adventofcode.com/2016/settings
. http://adventofcode.com/2016/auth/logout
. http://adventofcode.com/2016
. http://adventofcode.com/2016
. http://adventofcode.com/2016/leaderboard
. http://adventofcode.com/2016/stats
. http://adventofcode.com/2016/sponsors
. http://adventofcode.com/2016/sponsors
. https://en.wikipedia.org/wiki/Repetition_code
. http://adventofcode.com/2016
. http://adventofcode.com/2016/day/6/input