Beats 100% || O(1) space || C++ || Prefix Sum
Complexity
Time complexity: O(n)

Space complexity: O(1)
Code
# Complexity
- Time complexity: $$O(n)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: $$O(1)$$
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
#define ll long long
class Solution {
public:
    int waysToSplitArray(vector<int>& nums) {
        int n = nums.size();
        if(n == 1) return 0;
        ll rsum = accumulate(nums.begin(), nums.end(), 0LL), lsum = 0LL;
        int cnt = 0;
        for(int i=0; i<n-1; i++){
            lsum += nums[i];
            rsum -= nums[i];
            if(lsum >= rsum) cnt++;
        }
        return cnt;
    }
};
```
['Array', 'Prefix Sum', 'C++']