Advent of code 2023

Learnings

day 5:

  • when iterating over chunk of data and relying on the next data point to collect that data, watch out for the last line or last data point. It is easy to forget to collect the last data point.

day 6:

  • Doing map in python using map(func, list), this will return a map object, we can call list() on it to get list of mapped values
  • using regex to extract numbers in a line re.findall(r'\d+', times_line)
  • accumulating a list of numbers into a mulplied product using reduce from functools: reduce(operator.mul, counts, 1)