Most Visited Sector in a Circular Track
Given an integer n and an integer array rounds, there is a circular track consisting of n sectors labeled from 1 to n. A marathon is held on this track and consists of m rounds. The i^th round starts at sector rounds[i - 1] and ends at sector rounds[i]; for example, round 1 starts at sector rounds[0] and ends at sector rounds[1].
You circulate the track in ascending order of sector numbers in the counter-clockwise direction.
Return an array of the most visited sectors sorted in ascending order.
Example 1
Input
n = 4, rounds = [1,3,1,2]Output
[1,2]Sectors 1 and 2 are each visited twice, while sectors 3 and 4 are each visited once.
Example 2
Input
n = 2, rounds = [2,1,2,1,2,1,2,1,2]Output
[2]Sector 2 is visited more often than sector 1, so it is the only most visited sector.
Constraints
- 2 <= n <= 100
- 1 <= m <= 100
- rounds.length == m + 1
- 1 <= rounds[i] <= n
- rounds[i] != rounds[i + 1] for 0 <= i < m