Beats 100% of users with C++|| Using Presum and Postsum || Faster Solution || Easy to Understand ||
Intuition\n Describe your first thoughts on how to solve this problem. \n\nif you like the approach please upvote it\n\n\n\n\n\n\nif you like the approach pleas
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\nif you like the approach please upvote it\n\n\n\n![image.png](https://assets.leetcode.com/users/images/7495fea3-7639-48a4-8ad9-79dc9237db4e_1701793058.7524364.png)\n\n\nif you like the approach please upvote it\n\n\n\n\n\n\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->O ( N )\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int waysToSplitArray(vector<int>& nums) \n    {\n        long long int total=0;\n        long long int leftsum=0;\n        long long int rightsum=0;\n        int count=0;\n        for(int i=0;i<nums.size();i++)\n            total=nums[i]+total;\n        for(int i=0;i<nums.size()-1;i++)\n        {\n            leftsum=leftsum+nums[i];\n            rightsum=total-leftsum;\n            if(leftsum>=rightsum)\n                count++;\n        }\n        return count;\n    }\n};\n```
['Array', 'Prefix Sum', 'C++']