100% || C++
IntuitionHere check for equalizing the array with all possible values in the array and return the minimum
remaining consists of elements from index zero to firs
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Here check for equalizing the array with all possible values in the array and return the minimum
`remaining` consists of elements from index zero to first occurence of a number and elements from last occurence to last index

# Code
```cpp []
class Solution {
public:
    int minimumSeconds(vector<int>& nums) {
        int n=nums.size();
        unordered_map <int,vector<int>> hash;

        for(int i=0;i<n;i++){
            hash[nums[i]].push_back(i);
        }

        int ans=n;

        for(auto &[key,value]:hash){
            int max_value=0;
            for(int i=1;i<value.size();i++){
                int elements_change=(value[i]-value[i-1])/2;
                max_value=max(max_value,elements_change);
            }
            int remaining_elements=(n-value.back()+value[0])/2;
            max_value=max(max_value,remaining_elements);
            ans=min(ans,max_value);
        }

        return ans;
    }
};
```
['C++']