Advent of Code 2020 - Day 13Shuttle Search
| Problem statement | Source code | Tags: Modular arithmetic
Part 1
Once we have the list of bus IDs, we can compute the next time each bus arrives, which is the smallest multiple of the bus ID that is greater than or equal to the earliest timestamp: np.ceil(time / buses) * buses. We then find the bus with the smallest arrival time with np.argmin.
Part 2
If buses[i] departs at timestamp t + i, that means t + i is a multiple of buses[i], or