Module aoc::year2020::day15

source ·
Expand description

§Rambunctious Recitation

Hybrid solution that uses both a vec and FastMap to store previously seen values. This approach is faster than using either data structure alone. The threshold is chosen so that about 85% of values are stored in the vec.

To save space the vec is u32 instead of usize. Each difference is at least one so we can use zero as a special value to indicate numbers not seen before.

Accessing the map uses the Entry method as this reduces two key lookups to one.

Constants§

Functions§