Easy Approach in O(n) | Python
IntuitionWe are given a list nums of integers. The goal is to determine how many ways we can split the array nums into two non-empty subarrays such that the sum
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
We are given a list nums of integers. The goal is to determine how many ways we can split the array nums into two non-empty subarrays such that the sum of the elements in the left subarray is greater than or equal to the sum of the elements in the right subarray.

# Approach
<!-- Describe your approach to solving the problem. -->
1. **Prefix Sum Calculation:**

    We start by calculating the prefix sums of the array. The prefix sum at index i is the sum of all elements in the array from the beginning up to index i.
    This allows us to quickly calculate the sum of any subarray by using the relation:
    Sum of elements from index 0 to i-1: prefix_sum[i-1]
    Sum of elements from index i to n-1: total_sum - prefix_sum[i-1] where total_sum is the sum of all elements in the array.
2. **Iterate Over Possible Splits:**

    We then iterate through the array and consider each possible position i where we can split the array into two subarrays:
    The left subarray contains elements from index 0 to i-1.
    The right subarray contains elements from index i to n-1.
    For each split, we check whether the sum of the left subarray (prefix_sum[i-1]) is greater than or equal to the sum of the right subarray (total_sum - prefix_sum[i-1]). If this condition is satisfied, we increment the result counter.
3. **Return the Count:**

    The final result is the number of valid splits where the left subarray sum is greater than or equal to the right subarray sum.

# Complexity
### **Time complexity:**
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
**Prefix Sum Calculation:** The loop for computing the prefix sum runs in O(n) time.
**Iterating Through Array:** After that, we loop through the array from index 1 to n-1 to check the condition. This loop also runs in O(n) time.
**Overall Time Complexity:** O(n)

### Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
We store the prefix_sum array, which requires O(n) space.

# Code
```python3 []
class Solution:
    def waysToSplitArray(self, nums: List[int]) -> int:
        n = len(nums)
        s = sum(nums)
        prefix_sum = [0]*n
        for i in range(n):
            prefix_sum[i] = prefix_sum[i-1] + nums[i]

        res = 0
        for i in range(1, n):
            x = prefix_sum[i-1] 
            if x >= s - x:
                res += 1
        return res
```
['Prefix Sum', 'Python3']