Simple python3 solution | 594 ms - faster than 82.24% solutions
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(n)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n``` python3 []\nclass Solution:\n    def minimumSeconds(self, nums: List[int]) -> int:\n        group = defaultdict(list)\n        for i, elem in enumerate(nums):\n            group[elem].append(i)\n        \n        n = result = len(nums)\n        for indexes in group.values():\n            current = (indexes[0] + n - indexes[-1]) // 2\n            for a, b in pairwise(indexes):\n                current = max(current, (b - a) // 2)\n            result = min(result, current)\n        return result\n```
['Hash Table', 'Math', 'Greedy', 'Counting', 'Python3']