Simple Java Solution with fewer lines and no space complexity.
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nSimple Java solution wi
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nSimple Java solution with few line and less complexity :) \n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int minimumRightShifts(List<Integer> nums) {\n        int f=0;\n        int min=nums.get(0);\n        for(int i=0;i<nums.size()-1;i++){\n            if(f!=0 && nums.get(i+1)>min) {\n                return -1;\n            }\n            if(nums.get(i)>nums.get(i+1)){\n                if(f!=0){\n                    return -1;\n                }\n                f=i+1;\n            }\n            \n        }\n        return f==0?f:nums.size()-f;\n    }\n}\n```
['Java']