Function advent_of_code_2023::day_8::count_parallel_steps
source · fn count_parallel_steps(
instructions: &Vec<Instruction>,
network: &HashMap<&'_ str, (&'_ str, &'_ str)>
) -> usize
Expand description
Given a ghost starts at each of the nodes ending in A
, and each follows the instructions in
parallel, how many steps until they are all on a terminal node at the same time.
The ghosts each follow a fixed cycle of steps, so this can be determined using the least common multiple of each of their cycle lengths