Simple c++ using map
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 {\npublic:\n    int minimumSeconds(vector<int>& nums) {\n        int n=nums.size();\n        int ans=n-1;\n        unordered_map<int,vector<int>> mp;\n        for(int i=0;i<n;i++){\n            mp[nums[i]].push_back(i);\n        }\n        for(auto it:mp){\n            vector<int> v=it.second;\n            int len=v.size();\n            int maxi=(n-1)-(v[len-1]-v[0]);\n            for(int j=1;j<len;j++){\n                maxi=max(maxi,v[j]-v[j-1]-1);\n            }\n            ans=min(maxi,ans);\n        }\n        return (ans+1)/2;\n    }\n};\n```
['C++']