GREEDY || MAP
Code\n\nclass Solution {\npublic:\n    int minimumSeconds(vector<int>& nums) {\n        unordered_map<int,vector<int>> mp;\n        for(int i = 0; i < nums.size
# Code\n```\nclass Solution {\npublic:\n    int minimumSeconds(vector<int>& nums) {\n        unordered_map<int,vector<int>> mp;\n        for(int i = 0; i < nums.size(); i++){\n            mp[nums[i]].push_back(i);\n        }\n        int ans = nums.size(),x = 0;\n        for(auto &k: mp){\n            x = k.second[0];\n            int y =nums.size()-k.second.back()-1; \n            x += y;;\n            x = (x+1)/2;\n            for(int i = 0; i < k.second.size()-1; i++){\n                x = max(x,(k.second[i+1]-k.second[i])/2);\n            }\n            ans = min(ans,x);\n        }\n        return ans;\n    }\n};\n```
['Hash Table', 'Greedy', 'C++']