Back to questions

Largest Contiguous Subarray Sum Akuna Capital Python Interview Question

Largest Contiguous Subarray Sum

Akuna Capital Python Interview Question

Given an integer array, find the sum of the largest contiguous subarray within the array.

For example, if the input is [−1, −3, 5, −4, 3, −6, 9, 2], then return 11 (because of [9, 2]).

Note that if all the elements are negative, you should return 0.

p.s. this is the same as question 9.5 in Ace the Data Science Interview.

Input

(Python)

Output