Python 3   ||   7 lines, dict, iteration   ||   T/S: 51% / 42%
\nclass Solution:\n    def minimumSeconds(self, nums: List[int]) -> int:\n\n        n, d, mn = len(nums), defaultdict(list), inf\n\n        for i, num in enumer
```\nclass Solution:\n    def minimumSeconds(self, nums: List[int]) -> int:\n\n        n, d, mn = len(nums), defaultdict(list), inf\n\n        for i, num in enumerate(nums): d[num].append(i)\n\n        for arr in d.values():\n            arr.append(arr[0] + n)\n            mx = max([j-i for i, j in pairwise(arr)])\n            mn = min(mx, mn)\n\n        return mn//2\n```\n[https://leetcode.com/problems/minimum-seconds-to-equalize-a-circular-array/submissions/1292980525/](https://leetcode.com/problems/minimum-seconds-to-equalize-a-circular-array/submissions/1292980525/)\n\n\nI could be wrong, but I think that time complexity is *O*(*N*) and space complexity is *O*(*N*), in which *N* ~ `len(nums)`.
['Python3']