Skip to content

azizj1/advent-of-code

Repository files navigation

Advent of Code Solutions

My solutions to Advent of Code problems.

Quick Start

NodeJS

  1. Install dependencies via yarn install.
  2. Two options:
    1. Run and watch a single file via yarn watch-single, or
    2. Run and watch the last file changed under a specific year via yarn start.

Python

  1. Change directory cd python.
  2. Install virtualenv via pip3 install virtualenv.
  3. Run virtualenv ./env.
  4. Run source ./env/bin/activate.
  5. Run pip install -r py-requirements.txt.
  6. Run nodemon --exec python 2022/19.py.

2022

  1. Day 7 - No Space Left On Device
    • Iterator pattern
  2. Day 11 - Monkey in the Middle
    • How to a keep a number small without impacting its divisibility by a specific number
    • LCM
  3. Day 12 - Hill Climbing Algorithm
    • Dijkstra's algorithm and tips on it
  4. Day 15 - Beacon Exclusion Zone
    • Merge intervals/ranges
    • Complement of intervals/ranges
  5. Day 16 - Proboscidea Volcanium
    • Floyd–Warshall algorithm
    • DFS with backtracking one option but not others
  6. Day 19 - Not Enough Minerals
    • Constraint satisfaction problem (CSP)
    • Python to solve the linear programming problem
    • Typescript - Depth-first branch and bound relaxation
  7. Day 21 - Monkey Math
    • TODO
    • Plot it out and use linear regression

2021

Not advent of code, but just a fun problem I found on MorningBrew:

  1. MorningBrew - Minimum plus/minus to get sum of 100

2020

Work in progress.

2019

All problems are complete, but only some are worthy of notes:

2018

General problem solving tips

  1. Try reducing the problem space down. If there's 10 valves, or 8 monkeys, or 30 doors, etc. Imagine if there was just 1 or 2 valves or monkeys or doors. Solve that smaller problem space first.
  2. Look at the input, make sure there isn't any shortcut you can take. Maybe some monkeys you'll never visit, or some doors that don't ever have to be opened, or some valves you don't have to release pressure on because flow is 0, etc.
  3. Transform the problem space. This came in handy for 2019 day 18a and 2022 day 16. Convert the problem into a graph, or an adjacency matrix, etc. that is much easier to work on because of fewer variables.

About

Advent of Code Solutions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published