Easy Hash Solution ✅✅ Beats 100 % C++ Solution ✅✅
Complexity\n- Time complexity:O(N)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(N)\n Add your space complexity here, e.g. O(n) \n\n# Code
# Complexity\n- Time complexity:O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int minimumSeconds(vector<int>& nums) {\n        map<int,vector<int>> mp;\n        int n=nums.size();\n        for(int i=0;i<n;i++)\n        mp[nums[i]].push_back(i);\n        int ans=nums.size();\n        for(auto it:mp)\n        {\n            vector<int> temp=it.second;\n            int t=abs(temp[0]+n-temp[temp.size()-1]);\n            for(int i=0;i<temp.size()-1;i++)\n            t=max(t,temp[i+1]-temp[i]);\n            ans=min(ans,t);\n        }\n        return ans/2;\n    }\n};\n```
['Hash Table', 'C++']