Maximum Subarray
Given an integer array nums, find a contiguous, non-empty subarray with the largest sum and return that sum.
Input format
- First line: integer
n - Second line:
nintegersnums[0..n-1]
...
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:
