simple c++ solution
Code\n\nclass Solution {\npublic:\n    int minimumSeconds(vector<int>& nums) {\n       unordered_map<int, vector<int>> frequencyMap; \n        for (int i = 0; i
# Code\n```\nclass Solution {\npublic:\n    int minimumSeconds(vector<int>& nums) {\n       unordered_map<int, vector<int>> frequencyMap; \n        for (int i = 0; i < nums.size(); i++) { \n            frequencyMap[nums[i]].push_back(i); \n        } \n        int minSecondsNeeded = INT_MAX; \n        for (auto entry : frequencyMap) { \n            vector<int> positions = entry.second; \n            int currentSeconds = (positions[0] - 0) + (nums.size() - 1 - positions[positions.size() - 1]); \n            for (int i = 0; i < positions.size() - 1; i++) { \n                currentSeconds = max(currentSeconds, positions[i + 1] - positions[i] - 1); \n            } \n            currentSeconds = ceil(static_cast<double>(currentSeconds) / 2); \n            minSecondsNeeded = min(minSecondsNeeded, currentSeconds); \n        } \n        return minSecondsNeeded; \n    }\n};\n\n```
['Hash Table', 'C++']