HTMLify

LeetCode - Number of Ways to Split Array - Python
Views: 21 | Author: abh
class Solution:
    def waysToSplitArray(self, nums: List[int]) -> int:
        c = 0
        ls = 0
        rs = sum(nums)
        for i in range(len(nums)-1):
            n = nums[i]
            ls += n
            rs -= n
            if ls >= rs:
                c += 1
        return c

Comments