Easy Solution C++
Approach\n Use map\n\n\nCode* \n\nclass Solution { \npublic: \n    int minimumSeconds(vector<int>& nums) { \n        unordered_map<int,vector<int>> m; \n       
**Approach**\n* Use map\n\n\n**Code** \n```\nclass Solution { \npublic: \n    int minimumSeconds(vector<int>& nums) { \n        unordered_map<int,vector<int>> m; \n        int k=nums.size(); \n        for(int i=0;i<nums.size();i++){ \n            m[nums[i]].push_back(i); \n        } \n        for(auto &a :m){ \n            sort(a.second.begin(), a.second.end()); \n        } \n        int res = INT_MAX; \n        for(auto &a: m){ \n            int sz = a.second.size(); \n            int ans = (k-a.second.back()-1+a.second[0])/2+(k-a.second.back()-1+a.second[0])%2; \n           \n            for(int i=1;i< sz;i++){ \n                ans = max(ans, ((a.second[i]-a.second[i-1]-1)/2)+((a.second[i]-a.second[i-1]+1)%2)); \n            } \n             \n            res=min(res, ans); \n        } \n        return res; \n    } \n};\n```
['C++']