Java O(N) Time and Space 100% Faster
```\n\tpublic int maxChunksToSorted(int[] arr) {\n        int[] temp= new int[arr.length+1];\n        temp[arr.length]= Integer.MAX_VALUE;\n        for(int i= a
```\n\tpublic int maxChunksToSorted(int[] arr) {\n        int[] temp= new int[arr.length+1];\n        temp[arr.length]= Integer.MAX_VALUE;\n        for(int i= arr.length-1; i>=0; i--){\n            temp[i]= Math.min(arr[i],temp[i+1]);\n        }\n        int max= arr[0], chunks= 0;\n        for(int i=0; i<arr.length; i++){\n            max= Math.max(max,arr[i]);\n            if(max <= temp[i+1]) chunks++;\n        }\n        return chunks;\n    }
[]