Runtime 0 ms Beats 100.00%
IntuitionApproachComplexity
Time complexity:
n(n²)
Space complexity:
O(n)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)$$ -->
n(n²)
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
O(n)
# Code
```python3 []
class Solution:
    def minimumRightShifts(self, nums: List[int]) -> int:
        sortedArr = sorted(nums)
        if nums == sortedArr:
            return 0
        res = 0
        for i in range(len(nums)):
            temp = nums.pop()
            nums.insert(0, temp) 
            res += 1
            if nums == sortedArr:
                return res
        return -1
```
['Python3']