[C++/Python3] Very Concise Prefix Sum O(1)
Python\n\nclass Solution:\n    def waysToSplitArray(self, nums: List[int]) -> int:\n        lsum, rsum, ans = 0, sum(nums), 0\n        for i in range(len(nums) 
**Python**\n```\nclass Solution:\n    def waysToSplitArray(self, nums: List[int]) -> int:\n        lsum, rsum, ans = 0, sum(nums), 0\n        for i in range(len(nums) - 1):\n            lsum += nums[i]\n            rsum -= nums[i]\n            ans += (lsum >= rsum)\n        return ans\n\t\t\n```\n\n**C++**\n```\nclass Solution {\npublic:\n    int waysToSplitArray(vector<int>& nums) {\n        long long lsum = 0, rsum = 0, ans = 0;\n        for (int& num: nums) rsum += num;\n        for (int i = 0; i < nums.size() - 1; ++i) {\n            lsum += nums[i];\n            rsum -= nums[i];\n            ans += (lsum >= rsum);\n        }\n        return ans;\n    }\n};\n```
['Prefix Sum', 'Python3']