Maximum Subarray Sum

Given an integer array nums, find the maximum sum of a non-empty contiguous subarray. Use Kadane's algorithm with O(n) time and O(1) extra space.

Input: n, followed by n integers.

**Ou...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: