✅ Java ✅ Beats 100% ✅ Simple ✅
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
```java []
class Solution {
    public int waysToSplitArray(int[] nums) {
        long leftSum = 0;
        int res = 0;
        long rightSum = 0;

        for(int i = 0; i < nums.length; i++) {
            rightSum += nums[i];
        }

        for(int i = 0; i < nums.length - 1; i++) {
            leftSum += nums[i];
            rightSum -= nums[i];
            if(leftSum >= rightSum) {
                res++;
            }
        }
        return res;
    }
}
```
['Java']