Java O(n) Solution
In general idea is maximum till now should be less than minimum from right then only we can make chunk .(minimum have place in right array itself because it is 
In **general idea** is maximum till now should be less than minimum from right then only we can make chunk .(minimum have place in right array itself because it is greater than maximum of left).\nIf minimum from right is less than maximum from left then in sorted array the position of minimum is in left part so therefore we cannot create chunk in that case.. \n \nSteps to follow:\n1. Always check for edge case if array length is 0 what to do.\n2. Make 2 arrays maximum from left and minimum from left.\n3. now check maximum till now <= minimum from right then chunk is possible(increase chunk count)\n\n```\nclass Solution {\n    public int maxChunksToSorted(int[] arr) {\n        \n        if(arr.length==0) return 0;\n        int[] maxfromstart=new int[arr.length];\n        int[] minfromlast=new int[arr.length];\n         \n        maxfromstart[0]=arr[0];\n        for(int i=1;i<arr.length;i++){\n            if(arr[i]>maxfromstart[i-1]){\n                maxfromstart[i]=arr[i];\n            }else{\n                maxfromstart[i]=maxfromstart[i-1];\n            }\n        }\n        \n        minfromlast[arr.length-1]=arr[arr.length-1];\n        for(int i=arr.length-2;i>=0;i--){\n            if(arr[i]<minfromlast[i+1]){\n                minfromlast[i]=arr[i];\n            }else{\n                minfromlast[i]=minfromlast[i+1];\n            }\n        }\n        \n        int chunk=1; \n        for(int i=0;i<arr.length-1;i++){\n            if(maxfromstart[i]<=minfromlast[i+1]){\n                chunk++;\n            }\n        }\n        return chunk;\n    }\n}\n```\nTime:O(N) and Space:O(N)\nPlease **upvote** if you find it helpful :)
['Array', 'Java']