Java || Runtime : 0ms || 100% || Easy
If you love the solution please upvote\n\n\nclass Solution {\n    public int maxChunksToSorted(int[] arr) {\n        \n        int[] rmin = new int[arr.length+1
**If you love the solution please upvote**\n\n```\nclass Solution {\n    public int maxChunksToSorted(int[] arr) {\n        \n        int[] rmin = new int[arr.length+1];\n        rmin[arr.length]=Integer.MAX_VALUE;\n        for(int i=arr.length-1 ;i>=0;i--){\n            rmin[i]=Math.min(rmin[i+1],arr[i]);\n        }\n        \n        int lmax=Integer.MIN_VALUE, count=0;\n        for(int i=0; i<arr.length; i++){\n            lmax=Math.max(lmax,arr[i]);\n            if(lmax<=rmin[i+1]){\n                count++;\n            }\n        }return count;\n    }\n}\n```
['Java']