Solutions for Maximum subarray sum

    • @JavierVow
    • @jacob, submitted in Python 3, achived 100% score
    def solve(arr):
        if not arr or max(arr) < 0:
            return 0
    
        current_max_sum = arr[0]
        overall_max_sum = arr[0]
    
        for num in arr[1:]:
            current_max_sum = max(num, current_max_sum + num)
            overall_max_sum = max(overall_max_sum, current_max_sum)
    
        return overall_max_sum