View on GitHub

advent-of-code-2024

Readable Advent of Code 2024 algorithms and solutions in C language

Day 1: Historian Hysteria

Part A

Let $(a_0,\dots,a_{n-1}),(b_0,\dots,b_{n-1})$ be $n$-element lists with $a_i,b_i\in\mathbb{Z}$ for all $0\leq i\lt n$.

Algorithm:

Time complexity: $O(n\log n)$.

Space complexity: $O(1)$.

Part B

Let $X\subseteq\mathbb{N}$. Let $A,B$ be lists with $a,b\in X$ for all $a\in A,b\in B$.

Algorithm:

Time complexity: $O(n)$.

Space complexity: $O(1)$.