Java✔✔ || Easy🔥
\nclass Solution {\n    public int minimumRightShifts(List<Integer> nums) {\n        // finding the min value\n        int min = Integer.MAX_VALUE;\n        for
```\nclass Solution {\n    public int minimumRightShifts(List<Integer> nums) {\n        // finding the min value\n        int min = Integer.MAX_VALUE;\n        for (int i = 0; i < nums.size(); i++) {\n            min = Math.min(min, nums.get(i));\n        }\n        //finding the index of min value\n        int index = 0;\n        for (int i = 0; i < nums.size(); i++) {\n            if (nums.get(i) == min) {\n                index = i;\n            }\n        }\n        // now checking the condition\n        for (int i = index + 1; i < nums.size(); i++) {\n            if (nums.get(i) < nums.get(i - 1)) {\n                return -1;\n            }\n        }\n        for (int i = 0; i < index; i++) {\n            // its the special case where we are checking the first value to the last value\n            if (i == 0) {\n                if (nums.get(i) < nums.get(nums.size() - 1)) {\n                    return -1;\n                }\n            }\n            else if (nums.get(i) < nums.get(i - 1)) {\n                return -1;\n            }\n        }\n\t\t// if (index==0) return 0 else nums.size()-index\n        return index==0?0:(nums.size()-index);\n    }\n}\n```
['Java']