Simple and easy code
\n# Code\n\nclass Solution {\npublic:\n    int minimumRightShifts(vector<int>& nums) {\n        int n = nums.size();\n        vector<int> sorted_nums = nums;\n 
\n# Code\n```\nclass Solution {\npublic:\n    int minimumRightShifts(vector<int>& nums) {\n        int n = nums.size();\n        vector<int> sorted_nums = nums;\n        sort(sorted_nums.begin(), sorted_nums.end());\n\n        for (int i = 0; i < n; ++i) {\n            if (nums == sorted_nums) {\n                return i;\n            }\n            int last_element = nums.back();\n            nums.pop_back();\n            nums.insert(nums.begin(), last_element);  \n        }\n\n        return -1;\n    }\n};\n\n```
['C++']