Python 3 || 6 lines,  slice once & check   ||   T/S: 100% / 98%
\nclass Solution:\n    def minimumRightShifts(self, nums: List[int]) -> int:\n        \n        n = len(nums)\n    \n        for i in range(1, n):\n            
```\nclass Solution:\n    def minimumRightShifts(self, nums: List[int]) -> int:\n        \n        n = len(nums)\n    \n        for i in range(1, n):\n            if nums[i] < nums[i-1]:\n\n                    nums = nums[i:]+nums[:i]\n                    return n-i if nums == sorted(nums) else -1\n\n        return 0\n```\n[https://leetcode.com/problems/minimum-right-shifts-to-sort-the-array/submissions/1051163323/](http://)\n\n\nI could be wrong, but I think that time complexity is *O*(*N*log*N*) and space complexity is *O*(*N*), in which *N* ~ `len(nums)`. \n\n(Two thoughts:\n(1) TC could in practice be better than *O*(*N*log*N*) because for a number of testcases, the sum of the slices will be sorted already; and \n(b) the only data structure is the sum of the slices, which then immediately overwrites \'nums`, so an argument could be made for SC being closer to *O*(1))
['Python3']