Walk in the park✅0ms || 100%💯Efficient🔥🚀
One word – "Simulation"Complexity :
Time complexity: O(n2)

Space complexity: O(1)
Code
![image.png](https://assets.leetcode.com/users/images/88f403d5-6b48-442f-b9c9-f078e8760429_1738495408.2328815.png)

----
###### One word – "Simulation"
---
# Complexity :
- Time complexity: $O(n ^ 2)$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: $O(1)$
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int minimumRightShifts(vector<int>& nums) {
        int n = nums.size();
        for(int i = 0; i < n; ++i) {
            int j;
            for(j = i + 1; j < i + n; ++j) {
                if(nums[j % n] < nums[(j - 1) % n]) {
                    break;
                }
            }
            if(j == i + n)
                return i == 0 ? 0 : n - i;
        }
        return -1;
     }
};
```
['Array', 'Simulation', 'C++']