BEATS 100% EASY TO UNDERSTAND
IntuitionWe have to split the array in such a way that left hand side is equal to right hand side and atmost 1 element each side
OK
then we make left hand side
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
We have to split the array in such a way that left hand side is equal to right hand side and atmost 1 element each side 
OK 
then we make left hand side and right hand side total whenever lhs sum is greater than rhs sum we increment the answer by 1 

# Approach
<!-- Describe your approach to solving the problem. -->
Find totalSum 
Then make LHS sum here i took it as curr were we start from the beggining and keep adding up 
Make RHS sum here totalSum - each element from beggining

# 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 totalSum = 0;
        for(int n : nums){
            totalSum += n;
        }
        long curr = 0;
        int ans = 0;
        for(int i = 0;i<nums.length-1;i++){
            curr += nums[i];
            totalSum -= nums[i];
            if(curr >= totalSum){
                ans++;
            }
        }
        return ans;
    }
}
```
['Prefix Sum', 'Java']