🟩🟩🟩[Beats 100% Time Complexity] Easy Approach for Beginners.🟩🟩🟩
IntuitionApproachWe find the pivot where if we shift the array right to that pivot, we can get an increasing array. And how can we know if that array which we h
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->
We find the pivot where if we shift the array right to that pivot, we can get an increasing array. And how can we know if that array which we have after shift the original array is not increasing. Just check it again.

# Complexity
- Time complexity: O(n)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(n)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int minimumRightShifts(vector<int>& nums) {
        int ans=0;
        vector<int> test(nums.size());
        for(int i=0;i<nums.size()-1;i++){
            if(nums[i]>nums[i+1]){
                ans = nums.size()-i-1;
                break;
            }
        }

        for(int i=0;i<nums.size();i++){
            test[(i+ans)%nums.size()] = nums[i];
        }

        bool f=1;
        for(int i=0;i<test.size()-1;i++){
            if(test[i]>test[i+1]){
                f=0;
                break;
            }
        }
        if(!f) return -1;
        return ans;
    }
};
```
['C++']