Maximum Subarray Sum · Compiler
Maximum Subarray Sum
A shop records its net gain or loss each day. Find the greatest sum over a nonempty run of consecutive days.
- Input
- Line 1 contains the length n (1 to 100). Line 2 contains n space-separated integers, each from -1000 to 1000.
- Output
- Print the greatest sum as an integer.
Compiler Explorer runs your code when you run or check it.
Loading your exercise draft…