@@ -0,0 +1,951 @@
+#!/usr/local/bin/python%0A# Code Fights Array Max Consecutive Sum Problem%0A%0A%0Adef arrayMaxConsecutiveSum(inputArray, k):%0A    rolling_sum = sum(inputArray%5B:k%5D)%0A    max_sum = rolling_sum%0A    i = 0%0A    for j in range(k, len(inputArray)):%0A        rolling_sum = rolling_sum + inputArray%5Bj%5D - inputArray%5Bi%5D%0A        max_sum = max(rolling_sum, max_sum)%0A        i += 1%0A%0A    return max_sum%0A%0A%0Adef main():%0A    tests = %5B%0A        %5B%5B2, 3, 5, 1, 6%5D, 2, 8%5D,%0A        %5B%5B2, 4, 10, 1%5D, 2, 14%5D,%0A        %5B%5B1, 3, 2, 4%5D, 3, 9%5D,%0A        %5B%5B3, 2, 1, 1%5D, 1, 3%5D%0A    %5D%0A%0A    for t in tests:%0A        res = arrayMaxConsecutiveSum(t%5B0%5D, t%5B1%5D)%0A        ans = t%5B2%5D%0A        if ans == res:%0A            print(%22PASSED: arrayMaxConsecutiveSum(%7B%7D, %7B%7D) returned %7B%7D%22%0A                  .format(t%5B0%5D, t%5B1%5D, res))%0A        else:%0A            print((%22FAILED: arrayMaxConsecutiveSum(%7B%7D, %7B%7D) returned %7B%7D,%22%0A                   %22answer: %7B%7D%22).format(t%5B0%5D, t%5B1%5D, res, ans))%0A%0A%0Aif __name__ == '__main__':%0A    main()%0A

Solve Code Fights array max consecutive sum problem