Kidane's algorithm

August 20, 2018

Functional implementation of Kidane’s for max subarray sum.

from functools import reduce
from random import randomint

nums = [randomint(-100, 100) for _ in range(10)]
mmax = max(
          reduce(
            lambda acc, x: acc+[max(x, acc[-1]+x)], A[1:], [A[0]])
          )