in C with explanation
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```c []
int minimumRightShifts(int* nums, int numsSize) {
    int* arr1=(int*)malloc(numsSize*sizeof(int));
    //duplicating nums array
    for(int i=0;i<numsSize;i++){
        arr1[i]=nums[i];
    }
    //sorting arr1
    for(int i=0;i<numsSize-1;i++){
        for(int j=i;j<numsSize;j++){
            if(arr1[i]>arr1[j]){
                int temp=arr1[i];
                arr1[i]=arr1[j];
                arr1[j]=temp;
            }
        }
    }
    //initializing index to -1 which is used to find the pivot point
    int index=-1;
    //check for point of rotation
    for(int i=0;i<numsSize;i++){
        if(nums[i] > nums[(i+1) % numsSize]){
            // If `index` is already set, it means there are multiple rotations
            // Return -1 because the array cannot be a rotated sorted array
            if(index!=-1) return -1;
            // Set the `index` to the position after the detected rotation
            index=i+1;
        }
    }
    // If no rotation is detected (`index` is still -1), the array is already sorted
    if(index==-1) return 0;
    // Verify if the original array `nums` when rotated by `index` matches the sorted array `arr1`
    for(int i=0;i<numsSize;i++){
        if(nums[(i+index)%numsSize] !=arr1[i] ) 
         // If any element doesn't match, return -1
        return -1;
    }
    return numsSize-index;
}
```
['C']