Easy to get 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:\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    public int minimumSeconds(List<Integer> nums) {\n        int n = nums.size();\n        int ans = n - 1; \n        Map<Integer, List<Integer>> map = new HashMap<>();\n\n        for (int i = 0; i < n; i++) {\n            if (!map.containsKey(nums.get(i))) {\n                map.put(nums.get(i), new ArrayList<>());\n            }\n            map.get(nums.get(i)).add(i);\n        }\n\n        for (Map.Entry<Integer, List<Integer>> entry : map.entrySet()) { \n            List<Integer> v = entry.getValue(); \n            int len = v.size(); \n            int max = (n - 1) - (v.get(len - 1) - v.get(0));\n            for (int j = 1; j < len; j++) {\n                max = Math.max(max, v.get(j) - v.get(j - 1) - 1);\n            }\n            ans = Math.min(ans, max);\n        }\n        return (ans + 1) / 2;\n    }\n}\n```
['Java']