Advent of Code 2024

Solutions for 2024

Language: Python

Day 1 ⭐ ⭐

  1. Parse the input and find the difference and add them up
  2. Some numbers appear in both lists, so calculate a similarity score
  • Nice easy introduction for day 1
  • Getting the input in the right shape was easy
  • Pre-calculate part two with collections.Counter rather than counting each time

Day 2 ⭐ ⭐

  1. Check to see if the reports are all increasing or decreasing
  2. Check the reports, but with the ability to remove one value
  • Make a function and loop through the input
  • Use the same function, but with another function to edit possible input

Day 3 ⭐ ⭐

  1. Find the sum of the multiply statements - but find them first
  2. There’s a switch that turns the statements on and off
  • Regex only on day 3. Find the mul() statements, then evaluate them
  • Find the do() and don’t() statements as well, then iterate

Day 4 ⭐ ⭐

  1. Do a word search for XMAS
  2. Actually search for MAS in in X shape
  • Iterate for X and then go for different directions
  • Iterate for A and then go for different directions

Day 5 ⭐ ⭐

  1. Sum up the middle value of the updates that are in the correct order
  2. Sort the bad updates into the correct order and sum the middle values
  • Loop through the lists and if subsequent numbers are in the correct order, the whole list is in order
  • For the bad lists, place the pieces in the correct order, then sum up. More difficult than it sounds

Day 6

Day 7

Day 8 ⭐ ⭐

Day 9

Day 10

Day 11 ⭐ ⭐

Day 12

Day 13 ⭐ ⭐

Day 14

Day 15

Day 16

Day 17

Day 18

Day 19

Day 20

Day 21

Day 22

Day 23

Day 24

Day 25