1560. Most Visited Sector in a Circular Track

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1560

class Solution:
    def mostVisited(self, n: int, rounds: List[int]) -> List[int]:
        if rounds[0] <= rounds[-1]:
            return list(range(rounds[0], rounds[-1] + 1))
        return list(range(1, rounds[-1] + 1)) + list(range(rounds[0], n + 1))