sectors sectors numbered 1 to sectors. The runner always moves in increasing order of numbers, and after sector sectors comes sector 1 again.
The run consists of legs: leg i starts at sector checkpoints[i] and ends at sector checkpoints[i + 1]. The runner starts at checkpoints[0], which also counts as visited; the end of one leg is the start of the next and is not counted twice.
Return the sectors the runner visited the most times, in ascending order.sectors=5, checkpoints=[2, 4, 1] → [1, 2, 3, 4, 5]
The route is 2 → 3 → 4 → 5 → 1. Every sector is visited once, so all of them are the answer.
sectors=3, checkpoints=[3, 2, 1] → [1, 3]
The route is 3 → 1 → 2 (end of a leg) → 3 → 1. Sectors 1 and 3 are visited twice, sector 2 once.
sectors=5, checkpoints=[2, 4, 1]
[1, 2, 3, 4, 5]
Run checks the first 3 tests in your browser. Submit checks all 97 tests on the server, hidden ones included.