EASIEST SOLUTION | C/C++ | JavaScript | Python
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int waysToSplitArray(vector<int>& nums) {
        long long end = 0, start = 0;
        for(int i=0; i<nums.size(); i++)
            end += nums[i];
        int res = 0;
        for(int i=0; i<nums.size()-1; i++) {
            start += nums[i];
            end -= nums[i];
            if (start >= end) res++;
        }    
        return res;
    }
};
```
```c []
int waysToSplitArray(int* nums, int numsSize) {
    long long end = 0, start = 0;
    for(int i=0; i<numsSize; i++)
        end += nums[i];
    int res = 0;
    for(int i=0; i<numsSize-1; i++) {
        start += nums[i];
        end -= nums[i];
        if (start >= end) res++;
    }    
    return res;
}
```
```javascript []
/**
 * @param {number[]} nums
 * @return {number}
 */
var waysToSplitArray = function(nums) {
    let end = 0, start = 0;
    for(let i=0; i<nums.length; i++)
        end += nums[i];
    let res = 0;
    for(let i=0; i<nums.length-1; i++) {
        start += nums[i];
        end -= nums[i];
        if (start >= end) res++;
    }    
    return res;  
};
```
```python []
class Solution:
    def waysToSplitArray(self, nums: List[int]) -> int:
        end, start = 0, 0
        for i in range(0, len(nums)):
            end += nums[i]
        res = 0
        for i in range(0, len(nums)-1):
            start += nums[i]
            end -= nums[i]
            if start >= end: res += 1

        return res  
```
['Array', 'C', 'Prefix Sum', 'C++', 'Python3', 'JavaScript']