View on GitHub

advent-of-code-2024

Readable Advent of Code 2024 algorithms and solutions in C language

Day 8: Resonant Collinearity

Let $X\subseteq\mathbb{N}$. Let $m,n\in\mathbb{R}$. Let $L$ be a set where for all $(i,j,k)\in L$ we have $0\leq i\lt m$, $0\leq j\lt n$, and and $k\in X$.

Part A

Algorithm 1:

Time complexity: $O(\lvert X\rvert\cdot m^2n^2)=O(m^2n^2)$ for small $\lvert X\rvert$.

Space complexity: $O(\lvert X\rvert+mn)=O(mn)$ for small $\lvert X\rvert$.

Part B