Log in to get your input and submit your answers.
Day 10: Adapter Array
After an all-night coding sprint in the cluster, your laptop battery is at 1%. To make matters worse, all wall outlets in your row tripped due to a power surge.
You rummage through the Bocal's recycling bins and scavenge a collection of joltage adapters. Each line in your report corresponds to the rated output joltage of an adapter in jolts.
The connection rules are straightforward:
- The wall outlet delivers an initial output of
0 jolts. - Any adapter can take an input 1, 2, or 3 jolts lower than its own rated output.
- Your laptop has a built-in adapter rated for 3 jolts higher than the highest-rated adapter in your bag.
Part 1
To charge your machine, you decide to connect every single adapter in your bag into a single continuous chain from the wall outlet (0) to your laptop.
Example
Consider this sample collection of adapters:
16
10
15
5
1
11
7
19
6
12
4Sorting all adapters from the wall outlet (0 jolts) to your laptop (19 + 3 = 22 jolts):
0 -> 1 -> 4 -> 5 -> 6 -> 7 -> 10 -> 11 -> 12 -> 15 -> 16 -> 19 -> 22
Looking at the joltage differences between each step:
- There are 7 differences of 1 jolt (0 to 1, 4 to 5, 5 to 6, 6 to 7, 10 to 11, 11 to 12, and 15 to 16).
- There are 5 differences of 3 jolts (1 to 4, 7 to 10, 12 to 15, 16 to 19, and 19 to 22).
Multiplying these two counts yields 7 × 5 = 35.
Connect all adapters in your own input file into a single chain. What is the number of 1-jolt differences multiplied by the number of 3-jolt differences?