Simple solution -> Beats 100.00%
IntuitionApproachComplexity

Time complexity:
O(n)


Space complexity:
O(1)

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

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

# Complexity
- Time complexity:
O(n)

- Space complexity:
O(1)

# Code
```java []
class Solution {
    public int minimumRightShifts(List<Integer> nums) {

        int ans = 0, end = -1, n = nums.size();

        for (int i = 0; i < n - 1; i++)
            if (nums.get(i) > nums.get(i + 1)) {
                ans++;
                end = i;
            }

        if (ans == 0) return 0;
        else if (ans > 1 || nums.get(0) < nums.get(n - 1)) return -1;
        else return n - 1 - end;
    }
}
```
['Java']