This repository contains my personal solutions to Advent of code 2021.
All solutions are written in Python.
-
- Pytest
- GitHub actions
mapfunction
-
- type hinting
from typing import Listzipfunction- bitwise xor
^ - parsing binary numbers to decimals
- pytest
@fixture
-
zipfunction- transposing a matrix with
zipfunction - flatmap with Python generators
-
- named tuples
-
- using
popto simulate a queue with a list
- using
-
- speeding up recurring calls to function by memoizing the results with
@cachedecorator
- speeding up recurring calls to function by memoizing the results with
-
- all sorts of set operations
- iter and next
-
- enumerate
-
- regular expressions
- using a dict with coordinates to represent two dimensional maps
-
- Classes and objects
__str__and__repr__
-
- Thinking in terms of sets of coordinates and not two dimensional structures
-
- First puzzle that I could not solve alone. Found a hint for part 2 from Koodiklinikka.
- Using Counter to streamline counting character values
-
- Using Dijkstra's Algorithm to find minimum travel cost between two points
-
- Object oriented programming
- Superclasses and subclasses
- Overriding
__len__and__eq__ - Creating generator functions with
yieldkeyword
-
- Object oriented programming
-
- This was quite tricky
- Using reduce to add all snail numbers together
-
- This was again very difficult to solve...
- Yielding lambdas
-
- Working with infinite size images
-
- Second puzzle where I could not solve part 2 alone. Found a hint 2 from Koodiklinikka.
-
- Got a slow but working solution together after all.
- Splitting a collection overlapping 3D cubes into non-overlapping ones until no cubes overlap.
-
- Applying the shortest path logic to find the most efficient moves to solve a puzzle.
-
- Iterative and recursive calls to a list of functions to keep and cache intermediate results.
- Interpreting another languate into Python.
-
- Wrapping a 2D plane over the horizontal and vertical axes.