2808. Minimum Seconds to Equalize a Circular Array
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def minimumSeconds(self, nums: List[int]) -> int:
        n, idx_map, result = len(nums), defaultdict(list), float('inf')

        for idx, val in enumerate(nums):
            idx_map[val].append(idx)

        for positions in idx_map.values():
            positions.append(positions[0] + n)
            max_distance = max(j - i for i, j in zip(positions, positions[1:]))
            result = min(result, max_distance)

        return result // 2

```
['Python3']