1560. Most Visited Sector in a Circular Track
Read the full problem statement on LeetCode.
Difficulty: easy Acceptance: 59% Topics: Array, Simulation
View full problem on LeetCode Reading material
Reference solution (spoiler · python)
# Time: O(n)
# Space: O(1)
class Solution(object):
def mostVisited(self, n, rounds):
"""
:type n: int
:type rounds: List[int]
:rtype: List[int]
"""
return range(rounds[0], rounds[-1]+1) or \
range(1, rounds[-1]+1) + range(rounds[0], n+1)
Solution from kamyu104/LeetCode-Solutions · MIT