[Python 3] - Greedy + Hash Table - Simple Solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# 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```\nclass Solution:\n    def minimumSeconds(self, nums: List[int]) -> int:\n        n = len(nums)\n        p = collections.defaultdict(list)\n        d = collections.defaultdict(int)\n        for i, num in enumerate(nums):\n            p[num].append(i)\n            if len(p[num]) > 1:\n                p_num = p[num]\n                d[num] = max(d[num], p_num[-1] - p_num[-2] - 1)\n        res = n - 1\n        for num in d:\n            p_num = p[num]\n            d[num] = max(d[num], n - 1 - p_num[-1] + p_num[0])\n            res = min(res, d[num])\n        \n        return math.ceil(res / 2)\n\n```
['Hash Table', 'Greedy', 'Python3']