C++ Easy Solution , O(n) time and O(n) space
\nclass Solution {\npublic:\n    int maxChunksToSorted(vector<int>& arr) {\n        int n = arr.size();\n        int left[n],right[n];\n        left[0] = arr[0]
```\nclass Solution {\npublic:\n    int maxChunksToSorted(vector<int>& arr) {\n        int n = arr.size();\n        int left[n],right[n];\n        left[0] = arr[0];\n        right[n-1] = arr[n-1];\n        for(int i=1;i<n;i++)\n            left[i] = max(arr[i],left[i-1]);\n        for(int i = n-2;i>=0;i--)\n            right[i] = min(arr[i],right[i+1]);\n        int ans=1;\n        for(int i=0;i<n-1;i++){\n            if(left[i]<=right[i+1])\n                ans++;\n        }\n        return ans;\n    }\n};\n```
[]