Easy C++ solution using prefix sum concept
\nclass Solution {\npublic:\n    int maxChunksToSorted(vector<int>& arr) {\n        // vector \'v\' will be the sorted version of the original vector\n        v
```\nclass Solution {\npublic:\n    int maxChunksToSorted(vector<int>& arr) {\n        // vector \'v\' will be the sorted version of the original vector\n        vector<int>v=arr;\n        \n        // sort vector \'v\'\n        sort(v.begin(),v.end());\n        \n        // \'sum\' will be the running sum of the partitions\n        long long sum=0;\n        \n        // prefix[i] = arr[0]+arr[1]+....+arr[i].\n        vector<long long>prefix(arr.size());\n        for(int i=0;i<v.size();i++) {\n            prefix[i]=(i>0?prefix[i-1]+v[i]:v[i]);\n        }\n        \n        // \'count\' will be our answer\n        // \'low\' is the starting index of the current partition.\n        int count=0,low=0;\n        \n        for(int i=0;i<arr.size();i++) {\n            // calculate the running sum\n            sum+=arr[i];\n            \n            // if at any index the running sum becomes equal to the prefix sum of that partition that means we\'ve reached the end of a valid partition\n            if((low==0 && sum==prefix[i]) || (low>0 && sum==prefix[i]-prefix[low-1])) {\n                \n                // so increment the chunk count as we\'ve detected one more partition\n                count++;\n                \n                // according to the definition of \'low\' , it should be set to the next index as it will be the starting index of the next partition.\n                low=i+1;\n                \n                // set \'sum\' = 0 as we are going to start a fresh/new partition so it will cover the fresh sum of the next partition\n                sum=0;\n            }\n        }\n        \n        // finally return the answer\n        return count;\n    }\n};\n```\n***Please upvote if you have got any help from my code. Thank you.***
['C', 'Prefix Sum']