C++
\nclass Solution {\npublic:\n    int minimumSeconds(vector<int>& nums) {\n        unordered_map<int, vector<int>>Map ;\n        int n = nums.size() ;\n        f
```\nclass Solution {\npublic:\n    int minimumSeconds(vector<int>& nums) {\n        unordered_map<int, vector<int>>Map ;\n        int n = nums.size() ;\n        for(int i = 0; i < n; i++){\n            Map[nums[i]].push_back(i) ;\n        }\n        int ret = INT_MAX ;\n        for(auto& [key, arr] : Map){\n            int d = 0 ;\n            arr.push_back(arr[0]+n) ;\n            for(int i = 0; i < arr.size()-1; i++){\n                d = max(d, (arr[i+1]-arr[i])/2) ;\n            }\n            ret = min(ret, d) ;\n        }\n        return ret ;\n    }\n};\n```\n
[]