Easy Solution
\n# Approach\n Describe your approach to solving the problem. \nThe code essentially performs a series of right shifts on the input vector until it becomes sort
\n# Approach\n<!-- Describe your approach to solving the problem. -->\nThe code essentially performs a series of right shifts on the input vector until it becomes sorted. The circular shift is achieved by copying each element to the next position (with wrap-around) in the temporary vector temp. The counter cnt keeps track of the number of shifts, and if it exceeds the size of the vector, it returns -1 to indicate that sorting is not possible. Otherwise, it returns the count of shifts required to sort the vector.\n\n# Code\n```\nclass Solution {\npublic:\n    int minimumRightShifts(vector<int>& nums) {\n        int n = nums.size(); \n        \n        int cnt = 0; // Initialize a counter to keep track of the number of right shifts.\n\n        while (!is_sorted(nums.begin(), nums.end())) { // Continue looping until the vector is sorted.\n            vector<int> temp(n, 0); // Create a temporary vector of the same size as nums.\n\n            for (int i = 0; i < n; i++) {\n                // Shift the elements to the right by one position (circular shift).\n                temp[(i + 1) % n] = nums[i];\n            }\n        \n            cnt++; // Increment the shift counter.\n            nums = temp; // Update nums with the newly shifted vector.\n\n            if (cnt > n) {\n                // If the number of shifts exceeds the size of the vector, \n                // it means it\'s not possible to sort it.\n                return -1;\n            }\n        }\n        \n        return cnt; // Return the total number of right shifts required to sort the vector.\n    }\n};\n\n```
['C++']