C++ || O(n) solution || With comments
\nclass Solution {\npublic:\n    int waysToSplitArray(vector<int>& nums) {\n        \n        long long sum=0, lsum=0,rsum=0;\n        \n        //calculate sum
```\nclass Solution {\npublic:\n    int waysToSplitArray(vector<int>& nums) {\n        \n        long long sum=0, lsum=0,rsum=0;\n        \n        //calculate sum of all values in nums\n        for(auto i:nums){\n            sum+=i;\n        }\n        \n        int n=nums.size(),res=0;\n    \n        for(int i=0;i<n;i++){\n            lsum+=nums[i];//calculate left sum\n            \n            rsum=sum-lsum;//calculate right sum\n            \n            if(i<n-1 && lsum>=rsum){\n                // increment result if there is atleast \n                //one element after i and left sum is \n                //greater than equal to right sum\n                res++; \n            }\n        }\n        return res;\n    }\n};\n```
['C', 'Prefix Sum']