✅✅Beats 100%🔥C++🔥Python|| 🚀🚀Super Simple and Efficient Solution🚀🚀||🔥Python🔥C++✅✅
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 []
class Solution {
 public:
  int waysToSplitArray(vector<int>& nums) {
    int ans = 0;
    long prefix = 0;
    long suffix = accumulate(nums.begin(), nums.end(), 0L);
    for (int i = 0; i < nums.size() - 1; ++i) {
      prefix += nums[i];
      suffix -= nums[i];
      if (prefix >= suffix)
        ++ans;
    }
    return ans;
  }
};
```
```python []
class Solution:
  def waysToSplitArray(self, nums: list[int]) -> int:
    ans = 0
    prefix = 0
    suffix = sum(nums)
    for i in range(len(nums) - 1):
      prefix += nums[i]
      suffix -= nums[i]
      if prefix >= suffix:
        ans += 1
    return ans
```
['Array', 'Prefix Sum', 'C++', 'Python3']