Simple Solution using maps:fun
class Solution {\npublic:\n    \n    int maxChunksToSorted(vector& arr)\n    {\n        vectorp=arr;\n        sort(p.begin(),p.end());\n        int cnt=0;\n    
class Solution {\npublic:\n    \n    int maxChunksToSorted(vector<int>& arr)\n    {\n        vector<int>p=arr;\n        sort(p.begin(),p.end());\n        int cnt=0;\n        map<int,int>a,b;//a for storing sorted values and b for original values\n        for(int i=0;i<arr.size();i++)\n        {\n            a[p[i]]++;\n            b[arr[i]]++;\n            if(a==b)\n            {\n                cnt++;\n            }\n        }\n        return cnt;\n    }\n};
['C']