“Some kind of electrical surge seems to have fried them. I’ll try to get them online soon.”
Github: GCaggianese/AoC-2025/D3
Puzzle Day 3: Lobby
Part One:
- int jolt = 0;
- make a list and a copy of it of the input,
og,aux1 aux1will drop the last value ex.:987654321111118→98765432111111- you’ll take the max here → jolt += aux1.max*10
- create a 2nd list
aux2, slice of theogfrom the next position of the max before ex.:98765432111111max = 9 →aux2=87654321111118 - you’ll take the max here → jolt += aux2.max
Part Two:
- long jolt = 0;
- multiplier = 10^11 (since we’re building a 12-digit number)
- for i = 0 to 11 (picking 12 digits):
- remaining~needed~ = 12 - i
- window = og[0 .. og.length - remaining~needed~ + 1] (leave enough elements for future picks) ex.: first pick from
234234234234278, need 12 digits window =[2,3,4,2](must leave 11 for later) - pick maxVal from window → jolt += maxVal * multiplier
- slice og from maxIdx+1 onward (discard everything up to & including pick) ex.: picked 4 at idx 2 → og becomes
[2,3,4,2,3,4,2,7,8] - multiplier /= 10
- Summary: pick the highest available digit that still leaves enough digits remaining to complete 12 picks