15 lines
382 B
Python
15 lines
382 B
Python
# https://leetcode.com/problems/number-of-ways-to-split-array
|
|
|
|
from typing import List
|
|
|
|
class Solution:
|
|
def waysToSplitArray(self, nums: List[int]) -> int:
|
|
result = 0
|
|
right = sum(nums)
|
|
left = 0
|
|
for i in range(len(nums) - 1):
|
|
right -= nums[i]
|
|
left += nums[i]
|
|
result += int(left >= right)
|
|
return result
|
|
|