Easy in C++
\n# Code\n\nclass Solution {\npublic:\n    int minimumRightShifts(vector<int> &nums)\n    {\n    int n = nums.size();\n    vector<int> sortedNums = nums;\nsort(
\n# Code\n```\nclass Solution {\npublic:\n    int minimumRightShifts(vector<int> &nums)\n    {\n    int n = nums.size();\n    vector<int> sortedNums = nums;\nsort(sortedNums.begin(), sortedNums.end());\n\n    for (int i = 0; i < n; ++i) {\n        if (nums == sortedNums) {\n            return i;\n        }\n        int last = nums.back();\n        nums.pop_back();\n        nums.insert(nums.begin(), last);\n    }\n\n    return -1;\n\n    }\n\n};\n```
['Array', 'Sorting', 'C++']