def find_max(L):
    length = len(L)
mid_index = length / 2
if length == 0:
    return 0
elif length == 1:
    return max(L[0], 0)
left = find_max(L[:mid_index])
right = find_max(L[mid_index:])
left_half = right_half = 0
accum = 0
for x in L[mid_index - 1::-1]:
    accum += x
left_half = max(left_half, accum)
accum = 0
for x in L[mid_index:]:
    accum += x
right_half = max(right_half, accum)
return max(left, right, left_half + right_half)
assert find_max([]) == 0
assert find_max([-1]) == 0
assert find_max([1, 2, 3]) == 6
assert find_max([2, -5, 3]) == 3
assert find_max([-5, 1, 4, -2, 2, -1, 2, -3, 1, -3, 4]) == 6
Генерирующая рекурсия для поиска подсписка с максимальной суммой