Brute Force || C++ || 90% Fast
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        unordered_map<int,vector<int>> mp;\n\n        int n= nums.size();\n        for(int i=0; i<n; i++){\n            mp[nums[i]].push_back(i);\n        }\n        if(mp.size() == n) return n/2;\n        if(mp.size() == 1) return 0;\n        vector<int> vec;\n        int freq =0;\n        for(auto it: mp) freq= max(freq, (int)it.second.size());\n        for(auto it:mp){\n            vec.push_back(it.first);\n        }\n        int ans=INT_MAX;\n        for(int i=0; i<vec.size(); i++){\n            vector<int> temp= mp[vec[i]];\n            int maxi=0;\n            for(int j=0; j< temp.size(); j++){\n                if(j == temp.size()-1) maxi = max(maxi, abs(temp[0]+n-temp[temp.size()-1]));\n                else maxi= max( maxi, abs(temp[j+1]- temp[j]));\n            }\n            ans = min(ans, maxi/2);\n        }\n        return ans;\n    }\n};\n```
['C++']