Medium
Maximum Subarray
Topic: Dynamic Programming •
Acceptance: 56%
Given an integer array `nums`, find the subarray with the largest sum, and return its sum (Kadane's Algorithm).
Input Format:
First line: n. Second line: n space separated integers.
Output Format:
Print the maximum subarray sum.
Sample Example:
Sample Input:
9 -2 1 -3 4 -1 2 1 -5 4Sample Output:
6
Sandboxed Engine
Ready to test. Click Test All Cases or Submit Solution to evaluate your code.
// Code Playground Cloud Execution Engine v2.4
// Write your code and click 'Run Code' to execute.
$ ready
Standard Input (stdin):
Your code can read standard input via
stdin.