Most Easiest Solution || Intuitive || Pattern
In this type of rotation problems , what is recommend is to duplicate the array , add same array behind the original one and now check if there is a subarray of
In this type of rotation problems , what is recommend is to duplicate the array , add same array behind the original one and now check if there is a subarray of length \'n\' which is sorted , if yes then no of right shift = (n-i-2)%size . else you cannot .\n\n\n\n```\nint minimumRightShifts(vector<int>& nums) {\n        int size=nums.size(),counter=0;\n        \n        for(int i=0;i<size;i++){\n            nums.push_back(nums[i]);\n        }\n        \n        int n=nums.size();\n        \n        for(int i=0;i<n-1;i++){\n            if(nums[i]<nums[i+1]) counter++;\n            else counter=0;\n            \n            if(counter==size-1) return (n-i-2)%size;\n        }\n        \n        return -1;\n    }\n```\n\n\nTime Complexity :- O(n)\n\nSpace Complexity :- O(n)\n\n\n\nPlease Upvote if you like the solution\uD83D\uDC4D
['C']