class Solution:
    def maxSubArray(self, nums: list[int]) -> int:
        f = []
        f.append(nums[0])
        i = 1
        while i < len(nums):
            f.append(max(f[i-1] + nums[i],nums[i]))
            i = i + 1
        return max(f)

if __name__ == "__main__":
    mac = Solution()

    print(mac.maxSubArray([5,4,-1,7,8]))
cdf3cc500af4983f0634eb70f257a0fa4fd78838
<mask token>

class Solution:
    <mask token>


<mask token>

class Solution:

    def maxSubArray(self, nums: list[int]) ->int:
        f = []
        f.append(nums[0])
        i = 1
        while i < len(nums):
            f.append(max(f[i - 1] + nums[i], nums[i]))
            i = i + 1
        return max(f)


<mask token>

class Solution:

    def maxSubArray(self, nums: list[int]) ->int:
        f = []
        f.append(nums[0])
        i = 1
        while i < len(nums):
            f.append(max(f[i - 1] + nums[i], nums[i]))
            i = i + 1
        return max(f)


if __name__ == '__main__':
    mac = Solution()
    print(mac.maxSubArray([5, 4, -1, 7, 8]))

class Solution:
    def maxSubArray(self, nums: list[int]) -> int:
        f = []
        f.append(nums[0])
        i = 1
        while i < len(nums):
            f.append(max(f[i-1] + nums[i],nums[i]))
            i = i + 1
        return max(f)

if __name__ == "__main__":
    mac = Solution()

    print(mac.maxSubArray([5,4,-1,7,8]))