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:

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
4

Sorting 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:

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?