Easy Python approch using DefaultDict
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:\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        ans = 10000000000\n        diff = 0\n        cnt = collections.defaultdict(list)\n        for i in range(len(nums)):\n            if nums[i] not in cnt:\n                cnt[nums[i]] = [i,diff,i]\n                \n            if nums[i] in cnt:\n                # diff = len(nums)-i-1+cnt[nums[i]][2]\n                diff = max(cnt[nums[i]][1],i-cnt[nums[i]][0]-1)\n                cnt[nums[i]][0] = i\n                cnt[nums[i]][1] = diff\n            \n        \n        for i in cnt:\n            diff = len(nums)-cnt[i][0]-1+cnt[i][2]\n            cnt[i][1] = max(cnt[i][1],diff)\n            ans = min(ans,cnt[i][1])\n                \n        # print(cnt)\n                \n        if ans%2 == 1:\n            return (ans//2)+1\n        else:\n            return ans//2\n            \n                \n                \n                \n            \n            \n                \n        \n```
['Python3']