aoc::year2021

Module day07

Source
Expand description

ยงThe Treachery of Whales

Part 1 is a disguised definition of the mathematical median. We can calculate the result immediately using the standard algorithm.

Part 2 is found by using the mean. However since this could a floating point value and we are using integers we need to check 3 values total, the rounded result and one value on either side to ensure the correct answer.

Functionsยง