No description
  • Go 98.5%
  • JavaScript 1.2%
  • Ruby 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-12-05 12:37:46 -05:00
go feat(go): day05 complete 2026-12-05 12:37:46 -05:00
.gitignore chore(git): add /.openidea to .gitignore 2026-12-03 16:52:29 -05:00
.golangci.yml feat(go): day02 complete 2026-12-02 14:44:31 -05:00
.markdownlint.yaml chore(go): scaffolding for Go project 2026-12-02 11:55:55 -05:00
Brewfile chore(go): scaffolding for Go project 2026-12-02 11:55:55 -05:00
commitlint.config.mjs chore(go): scaffolding for Go project 2026-12-02 11:55:55 -05:00
eslint.config.js chore(go): scaffolding for Go project 2026-12-02 11:55:55 -05:00
go.mod chore(go): scaffolding for Go project 2026-12-02 11:55:55 -05:00
go.sum chore(go): scaffolding for Go project 2026-12-02 11:55:55 -05:00
LICENSE chore(go): scaffolding for Go project 2026-12-02 11:55:55 -05:00
package-lock.json chore(go): scaffolding for Go project 2026-12-02 11:55:55 -05:00
package.json chore(go): scaffolding for Go project 2026-12-02 11:55:55 -05:00
README.md docs(readme): add day03 discussion 2026-12-04 17:45:33 -05:00
stave.yaml chore(go): scaffolding for Go project 2026-12-02 11:55:55 -05:00
stavefile.go chore(go): scaffolding for Go project 2026-12-02 11:55:55 -05:00

advent-of-code-2026

The directory-structure in this repo is kind of bespoke, but the solutions to each day's puzzles live here.


Note

These are NOT intended as the simplest or most-straightforward solutions to any of these puzzles. (Though, on some of them, I DID opt for solutions that would scale better as opposed to just working on the scale of input provided, just for the intellectual challenge.) Instead, the point here is to play with stuff, and to learn.

To cite one example, consider day01:

  • I chose a solution that uses a fixed-size heap to sort the ID occurrence-counts, so that the solution's run time scales linearly in the size of the input N, even when the number of unique IDs K (where K ≤ N, of course) is such that K log K > N. (And so sorting the occurrence-counts would take longer than counting the occurrences.) This is the case in the actual puzzle input, btw... 😂 But even if it wasn't, it would still be fun to ponder. And having fun is the whole point. 🤓
  • I implemented the min- and max-heaps (for the two parts of the puzzle) not in any one of a myriad straightforward ways - most notably, by just reversing the polarity of the counts themselves, from positive to negative numbers - but instead, by using Go generics and custom type-constraints, creating a generic heap data-structure that gets its particular two-way comparison function from the particular data-type that is sitting in the heap. And I only did it this way because I wanted an opportunity to play with generics and custom type-constraints. 🤷‍♂️

Or, to cite another example, consider day03:

  • Both parts of the day03 puzzle lend themselves to fairly naive run-multiple-cursors-through-the-entire-board kind of solutions. This yields run time complexities of:
    • O(N^3) for part A (find all occupied cells by scanning the board, which is N^2, and iterate over the size of the putative square, which is another N for each iteration of the former where the cell was occupied).
    • O(N^4) for part B (find all occupied pairs of cells, which is N^4, then calculate the opposing corners and check them, which is constant complexity).
  • But, we can store both the board and a list of the coordinates of occupied cells (it takes O(N^2) to populate that list, but this can be done in the course of reading in the board, which is a O(N^2) process anyway).
  • By iterating over pairs of occupied cells (and checking for the occupancy of their "opposing" corners directly in the board representation), we can reduce the complexity of both parts to:
    • O(K^2), where K is the number of occupied cells.
  • Since K ≤ N^2 (by definition) - and significantly so, in the actual puzzle input - this is guaranteed to improve at least the part B performance.
    • And in practice, given the sparseness of occupied cells in the actual puzzle input, it significantly improves the performance of both part A and part B.