Skip to content

Latest commit

 

History

280 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advent of Code

This repo serves a few purposes. First, it's just a fun challenge, and the more advanced problems are a good motivator for studying math, data structures, and algorithms. This repo also serves as a portfolio project where I can show off some useful skills, such as creating my own data structures for working with multi-dimensional data. Finally, I also use the simpler problems as a way to familiarize myself with new programming languages.

Portfolio

The TypeScript section best represents my coding ability on a professional level. Most of my professional experience has been building high-performance data visualizations in the browser. For 2025, I decided to practice working with data structures that operate on continuous arrays of typed values—the same type of data that is sent to and read from the GPU when working with the WebGPU API.

  • Strided-Array: Many of my 2025 solutions rely on a custom strided-array utility. This allows me to represent multi-dimensional data in a single continuous array, which is much more memory-efficient and performant than using arrays of objects or nested arrays.

  • Strided-Heap: I also implemented a Min/Max Heap that operates on strided data. This allows me to perform priority queue operations on multi-dimensional items (like the distances used in Day 8) without the overhead of creating thousands of temporary objects.

  • KD-Tree: Day 8 2025 required finding 3D points that are close to each other. This was the perfect chance to implement a KD-Tree that operates on a strided array. A KD-Tree is essentially a binary search tree for multi-dimensional data. First, I implemented quick-sort and quick-select functions that operate in place on a continuous strided array. The multi-dimensional quick-select function can be used to mutate the array into the structure of a KD-Tree.

  • Linear Algebra: Day 10 2025 part 2 was the most challenging problem of the year for me. This problem involved optimizing a set of integral linear equations (Diophantine equations). I began with a quick refresher of linear algebra involving real numbers. I created some utility functions to handle common matrix operations to solve the homework problems I was working on.

  • Linear Algebra with Integer Constraints: Once I had a handle on finding solutions to continuous linear equations, I moved on to Diophantine equations. First, I implemented a function to convert a matrix into Hermite Normal Form. This allowed me to see that many of the lines had no free variables at all and could be solved directly. I was also able to determine that in the remaining lines the max number of free variables to solve for was 3. This drastically reduces the search space and we can just iterate over the remaining combination of variables to find the one that gives us the most optimal solution.

The alternative to Day 10 would be to use a constraint solver to find an optimal solution, but I was trying to solve this without using any external libraries.

Usage

Each language directory has three scripts: run, check, and format.

First, navigate to the language directory:

cd languages/typescript

run

You can run one day at a time or all at once.

# if no year is included, defaults to 2025
./run 3       # runs src/2025/day03.ts
./run 11      # runs src/2025/day11.ts

./run 3 2023  # runs src/2023/day03.ts

./run all     # runs all days

check

Runs unit tests and linter.

./check

format

Runs the formatter.

./format

Global Runners

From the project root, you can use these scripts to run across all languages:

  • run-all: Run all days for all languages.
  • check-all: Run the check script for all languages.
  • format-all: Run the format script for all languages.

About

Solve Advent of Code 2025 challenges in various languages

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages