C++ | Easy O(n) solution
\n# Code\n\nclass Solution {\npublic:\n    int minimumRightShifts(vector<int>& nums) {\n        int min = -1, count = 0;\n        int n = nums.size();\n        
\n# Code\n```\nclass Solution {\npublic:\n    int minimumRightShifts(vector<int>& nums) {\n        int min = -1, count = 0;\n        int n = nums.size();\n        for(int i = 1; i< n ; i++){\n            if(nums[i-1] > nums[i]){\n                min = i;\n                count++;\n            }\n        }\n        \n        if(min == -1) return 0;\n        if(count > 1 || nums[0] < nums[n-1]) return -1;\n        return n-min;\n    }\n};\n```
['C++']