Easy C++ solution
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:\nO(n)\n\n- Space complexity:\nO(2n) //Two maps are used both of size n\n\n# Code\n``` //Loop runs n times\nclass Solution {\npublic:\n    int minimumSeconds(vector<int>& nums) {\n        int ans = nums.size();\n        int n = nums.size();\n        map<int,int>last;\n\n        //duplicating my original array and adding to end of \n        //original array\n        for(int i=0;i<n;++i){\n            nums.push_back(nums[i]);\n            last[nums[i]] = -1;\n        }\n         n = nums.size();\n\n        //max time will store the maximum time for converting any segment\n        //to some color x\n        map<int,int>max_time;\n        \n        for(int i=0;i<n;++i){\n            if(last[nums[i]] != -1){\n                //total time to convert all value in between ith and last index\n                //where ith value was present\n                int tot_time = (i - last[nums[i]]);\n                tot_time /= 2;\n                max_time[nums[i]] = max(max_time[nums[i]],tot_time);\n                \n            }\n            last[nums[i]] = i;\n        }\n        \n        //now minimum time out of all maximum time for all value possible is my answer\n        for(auto&x:max_time)ans = min(ans,x.second);\n        \n        return ans;\n    }\n};\n```
['C++']