[Rust / Elixir] 2 passes
Let the sum of the first i + 1 elements be left, and the sum of the others be right. Then left + right = total where total is the total sum.
If a cut is valid,
Let the sum of the first `i + 1` elements be `left`, and the sum of the others be `right`. Then `left + right = total` where `total` is the total sum.
If a cut is valid, then:
```text
left >= right
left >= total - left
total - 2 * left <= 0
```
# Complexity
- Time complexity: $$O(n)$$

- Space complexity: $$O(1)$$

# Code
```Rust []
impl Solution {
    pub fn ways_to_split_array(nums: Vec<i32>) -> i32 {
        let mut acc = nums.iter().map(|&x| x as i64).sum::<i64>();
        let mut ans = 0;
        let mut iter = nums.iter();
        iter.next_back(); // skip the last element.
        for &x in iter {
            acc -= x as i64 * 2;
            if acc <= 0 {
                ans += 1;
            }
        }
        ans
    }
}
```
```Elixir []
defmodule Solution do
  @spec ways_to_split_array(nums :: [integer]) :: integer
  def ways_to_split_array(nums) do
    Enum.sum(nums)
    |> solve(nums, 0)
  end
  
  defp solve(_, [_], ans), do: ans
  defp solve(acc, [x | tail], ans) do
    acc2 = acc - x * 2
    if acc2 <= 0 do
      solve(acc2, tail, ans + 1)
    else
      solve(acc2, tail, ans)
    end
  end
end
```
['Rust', 'Elixir']