All challenges
mediumarrays 10 XP per passing test

Maximum Subarray Sum (Kadane)

Problem

Given an array of integers, find the maximum contiguous subarray sum. The subarray can be empty, but in that case the sum is 0. The input is a single line of space-separated integers. The output is a single integer representing the maximum subarray sum.
(run your code to see output)
Advertisement
Sponsored