Maximum Gap | Commented
\nint minimumSeconds(vector<int>& nums) \n    {\n        int n=nums.size();\n        \n        if(n==1)\n            return 0;\n        \n        if(n==2)\n    
```\nint minimumSeconds(vector<int>& nums) \n    {\n        int n=nums.size();\n        \n        if(n==1)\n            return 0;\n        \n        if(n==2)\n            return nums[0]==nums[1]?0:1;  // base case\n        \n        int ans=n-2;  // even if all elements occur single time n-2 is the worst time\n        unordered_map<int,int>m1,m2;\n        unordered_map<int,int>m3;\n        \n        // m1 first occurence (for circular array)\n        // m2 last occurence\n        // m3 for every number the maximum time req to cover gap\n        \n        for(int i=0;i<nums.size();i++)\n        {\n            if(m1.find(nums[i])==m1.end())\n            {\n                m1[nums[i]]=i;\n                m2[nums[i]]=i;\n                m3[nums[i]]=0; // for single elements answer is n-2\n            }\n            else\n            {   \n                int gap=i-m2[nums[i]]-1; \n                int stepsRequiredToCoverGap=(gap+1)/2; // ceil value of gap\n                m3[nums[i]]=max(m3[nums[i]],stepsRequiredToCoverGap);\n                //cout<<m3[nums[i]]<<" ";\n                m2[nums[i]]=i;\n            }\n        }\n        \n        for(auto & x:m1)\n        {\n            int gap=n-(m2[x.first]-x.second+1);\n            int stepsRequiredToCoverGap=(gap+1)/2;\n            m3[x.first]=max(m3[x.first],stepsRequiredToCoverGap);\n            ans=min(m3[x.first],ans);\n        }\n        return ans;\n            \n    }\n\t```
['C']