In C++
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```cpp []\nclass Solution {\npublic:\n    int minimumSeconds(vector<int>& nums) {\n        int n = nums.size();\n        if (n == 1) return 0;\n\n        unordered_map<int, vector<int>> positions;\n        for (int i = 0; i < n; ++i) {\n            positions[nums[i]].push_back(i);\n        }\n\n        int minSeconds = n;\n        for (const auto& [value, indices] : positions) {\n            int maxGap = 0;\n            int m = indices.size();\n            for (int i = 1; i < m; ++i) {\n                maxGap = max(maxGap, indices[i] - indices[i - 1]);\n            }\n            maxGap = max(maxGap, indices[0] + n - indices[m - 1]);\n            minSeconds = min(minSeconds, maxGap / 2);\n        }\n\n        return minSeconds;\n    }\n};\n```
['C++']