Easy approach for beginner || Prefix Sum Algorithm
IntuitionTo determine the number of valid splits, we need to divide the array into two non-empty parts at each possible index and compare their sums. The key in
# Intuition
To determine the number of valid splits, we need to divide the array into two non-empty parts at each possible index and compare their sums. The key insight is to precompute the prefix sums of the array, allowing efficient calculation of the sum for any subarray.

# Approach
1. **Prefix Sum Calculation**:  
   - Compute a `prefix` array where `prefix[i]` represents the sum of the first `i` elements of the array `nums`.  
   - This allows us to compute the sum of any subarray efficiently using the formula:  
     $$\text{sum of subarray from index } i \text{ to } j = \text{prefix}[j+1] - \text{prefix}[i]$$

2. **Iterating Over Split Indices**:  
   - Iterate through all possible split indices `i` from `0` to `n-2` (inclusive), since the last element must belong to the right part to satisfy the condition.  
   - For each index `i`:
     - Compute the sum of the left part as $\text{prefix}[i+1] - \text{prefix}[0]$.  
     - Compute the sum of the right part as $\text{prefix}[n] - \text{prefix}[i+1]$.  
     - Check if the left part's sum is greater than or equal to the right part's sum.  

3. **Count Valid Splits**:  
   - If the condition is satisfied for an index, increment the count of valid splits.

4. **Return the Count**:  
   - Return the total count of valid splits.

# Complexity
- **Time complexity**:  
  $$O(n)$$  
  - Computing the `prefix` array requires $O(n)$.  
  - Iterating over the array to check split indices also requires $O(n)$.

- **Space complexity**:  
  $$O(n)$$  
  - The `prefix` array stores $n+1$ elements.

# Code
```javascript
/**
 * @param {number[]} nums
 * @return {number}
 */
var waysToSplitArray = function(nums) {
    let count = 0
    const prefix = Array(nums.length + 1).fill(0)

    for(let i=0; i<nums.length; i++){
        prefix[i+1] = prefix[i] + nums[i]
    }

    for(let i=0; i<nums.length-1; i++){
        const slpit_index = i + 1
        const left_sum = prefix[slpit_index] - prefix[0]
        const right_sum = prefix[prefix.length-1] - prefix[slpit_index]

        if(left_sum >= right_sum) count++
    }

    return count
};
```
['Prefix Sum', 'JavaScript']