AoC 2024 Day 11: Exponential Growthinator

Source: Day 11: Plutonian Pebbles

Full solution for today (spoilers!).

Part 1

Given a sequence of values v_n, replace each value with the first matching rule:

  • if v = 0 -> 1
  • If v has an even number of digits, split it (so v = 8675 becomes [86, 75])
  • Otherwise, v -> v * 2024

Calculate how many elements are in the sequence after 25 iterations.

read more...


AoC 2024 Day 9: Defraginator

Source: Day 9: Disk Fragmenter

Full solution for today (spoilers!).

Part 1

Given a disk layout alternating between files and empty spaces, move all files as early on the disk is possible, splitting into multiple blocks. Return a checksum on the disk.

Alternating means: 23331 would mean a 2 block file, 3 empty, a 3 block file, 3 empty, and a 1 block file.

The checksum is the sum of file_id * block_index for all occupied blocks. File IDs are assigned sequentially on initial generation.

read more...