Solution in C
Approach
Traverse the array to identify where the order breaks (i.e., when nums[i] > nums[i + 1]).
Track the index of the break (flag) and count the number of b
# Approach
- Traverse the array to identify where the order breaks (i.e., when `nums[i] > nums[i + 1]`).
- Track the index of the break (flag) and count the number of breaks (count).
- If more than one break is found, return -1 because sorting with one shift is impossible.
- If no break is found, return 0 because the array is already sorted.
If exactly one break is found, check if the last element is smaller than or equal to the first element, and if so, return the number of shifts needed; otherwise, return -1
# Code
```c []
int minimumRightShifts(int* nums, int numsSize) {
    int flag=0;
    int count=0;
    for(int i=0;i<numsSize-1;i++){
        if(nums[i]>nums[i+1]){
            flag=i+1;
            count++;
        }
    }
    if(count>1){
        return -1;
    }
    else if(flag==0){
        return 0;
    }
    else{
        if(nums[numsSize-1]>nums[0])
        return -1;
        else
        return (numsSize-flag);
    }
        }

```
['Array', 'C']