Beats 100% of users with C++
IntuitionTo solve the problem, I first considered the idea of iterating through the array and trying to split it into two non-empty parts. The challenge is to f

# Intuition
To solve the problem, I first considered the idea of iterating through the array and trying to split it into two non-empty parts. The challenge is to find a point where the sum of the left part is greater than or equal to the sum of the right part. This is where the comparison between the left and right sums comes into play.

# Approach
1. Calculate the total sum of the array to have a reference for comparisons.
2. Iterate through the array, maintaining the sum of the left part (`left_sum`).
3. For each index, calculate the right part sum by subtracting `left_sum` from the `total_sum`.
4. If the sum of the left part is greater than or equal to the right part, increment the count of valid splits.
5. Return the total count of valid splits.

# Complexity
- Time complexity: $$O(n)$$
    - The total sum is calculated in a single pass over the array, and the left sum is updated in each iteration. Hence, the time complexity is linear in terms of the number of elements.

- Space complexity: $$O(1)$$
    - The space complexity is constant because only a few extra variables are used for storing sums and the result.

# Code
```cpp
class Solution {
public:
    int waysToSplitArray(vector<int>& nums) {
        int n = nums.size();
        long total_sum = 0;
        for (int num : nums) {
            total_sum += num;  // Calculate total sum of the array
        }
        
        long left_sum = 0;
        int count = 0;
        
        for (int i = 0; i < n - 1; ++i) {  // We need at least one element in the right part
            left_sum += nums[i];
            if (left_sum >= total_sum - left_sum) {
                count++;
            }
        }
        
        return count;
    }
};
```

['C++']