Minimum Right Shifts to Sort the Array
Intuition\n Just take duplicate list and then sort that list and check the old list and set the value at index value. \n\n# Approach\n Describe your approach to
# Intuition\n<!-- Just take duplicate list and then sort that list and check the old list and set the value at index value. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\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 n = nums.size();\n        List<Integer>list=  new ArrayList<>(nums);\n        Collections.sort(nums);\n        if(nums.equals(list))\n            return 0;\n        for(int i = 0; i < n ;i++){\n            if(nums.equals(list)){\n             \n                  \n                return nums.size() - i;\n            }\n           \n        \n        int temp = nums.get(n-1);\n        for(int j = n-1;j>0;j--){\n            nums.set(j,nums.get(j-1));\n        }\n        nums.set(0,temp);\n        }\n        return -1;\n            \n    }\n}\n```
['Java']