🔥 Best Approach 🔥 Biweekly Contest 110 💯💯 ⬆⬆⬆
Code\n\nclass Solution {\npublic:\n\n    int diff(vector<int>& v, int n) {\n        if(v.size()==1) return n;\n        int maxi = 0;\n        for(int i=1; i<v.s
#  Code\n```\nclass Solution {\npublic:\n\n    int diff(vector<int>& v, int n) {\n        if(v.size()==1) return n;\n        int maxi = 0;\n        for(int i=1; i<v.size(); i++)\n            maxi = max(maxi, v[i]-v[i-1]);\n\n        maxi = max(maxi, v[0]+n-v[v.size()-1]);\n        return maxi;\n    }\n    \n    int minimumSeconds(vector<int>& v) {\n        unordered_map<int, vector<int>> mp;\n        int n = v.size(), mini = n;\n        \n        for(int i=0; i<n; i++)\n            mp[v[i]].push_back(i);\n        \n        for(auto it : mp)\n            mini = min(mini, diff(it.second, n));\n        \n        return mini/2;\n    }\n};\n```
['Ordered Map', 'C++']