Prefix Sum | O(1) Space
\nclass Solution {\npublic:\n    int waysToSplitArray(vector<int>& nums) {\n     \n        long long sumFromBack(0), sumFromFront(0);\n        for (auto& i : nu
```\nclass Solution {\npublic:\n    int waysToSplitArray(vector<int>& nums) {\n     \n        long long sumFromBack(0), sumFromFront(0);\n        for (auto& i : nums)     sumFromBack += i;\n        \n        int n(size(nums)), res(0);\n        for (auto i=0; i<n-1; i++) {\n            \n            sumFromFront += nums[i]; // sum of the first i + 1 elements\n            sumFromBack -= nums[i]; // sum of the last n - i - 1 elements.\n            if (sumFromFront >= sumFromBack)  res++;\n        }\n        return res;\n    }\n};\n```
['C', 'Prefix Sum']