View on GitHub

advent-of-code-2024

Readable Advent of Code 2024 algorithms and solutions in C language

Day 19: Linen Layout

Let $A,B$ be sets of sequences.

Let $m^\ast=\max_{a\in A}(\mathrm{len}(a)),n^\ast=\max_{b\in B}(\mathrm{len}(b))$.

Part A

Algorithm:

Time complexity: $O(\lvert B\rvert\cdot m^\ast\cdot n^\ast)$.

Space complexity: $O(\lvert A\rvert\cdot m^\ast+n^\ast)$.

Part B

Algorithm:

Time complexity: $O(\lvert B\rvert\cdot m^\ast\cdot n^\ast)$.

Space complexity: $O(\lvert A\rvert\cdot m^\ast+n^\ast)$.