[Python3] Two pointer || 46ms || beats 89%
Iterate from the start while the array is increasing.\n2. If the array was iterated to end without breaks \u2014 it\'s sorted. Return 0\n3. Iterate from the end
1. Iterate from the start while the array is increasing.\n2. If the array was iterated to end without breaks \u2014 it\'s sorted. Return 0\n3. Iterate from the end while the array is decreasing\n4. If the array is sorted `i` and `j` will be point to one index, but it\'s not enough to be sure that array will be sorted after shift. Additionally neet to check end of right subarray `nums[-1]` with start of left subarray `nums[0]`. \n5. Example `[236] [45]`: these two parts won\'t make a sorted array, because 5(end of right subarray) > 2 (start left subarray)\n```python3 []\nclass Solution:\n    def minimumRightShifts(self, nums: List[int]) -> int:\n        L = len(nums)\n        for i in range(1, L):\n            if nums[i-1] > nums[i] : break\n        else:\n            return 0 # sorted\n\n        for j in reversed(range(L)):\n            if nums[j-1] > nums[j]: break\n\n        return L - i if i == j and nums[-1] < nums[0] else -1   \n```\n![Screenshot 2023-12-01 at 12.54.25.png](https://assets.leetcode.com/users/images/ea8a4dd5-d536-4ab6-8ead-4254e947598b_1701424563.4481413.png)\n
['Two Pointers', 'Python', 'Python3']