Define the "maximum sub-array" of a given array as "a (consecutive) sub-array that has the biggest sum". Note there's no "non-zero" requirement. Output that sum.
Give a description of your code if possible.
Sample input 1:
1 2 3 -4 -5 6 7 -8 9 10 -11 -12 -13 14
Sample output 1: 24
Description 1:
The biggest sum is yielded by cutting 6 7 -8 9 10
out and summing up.
Sample input 2: -1 -2 -3
Sample output 2: 0
Description 2: It's simple :) An empty subarray is the "biggest".
Requirement:
- Don't read anything except stdin, and output should go to stdout.
- Standard loopholes restrictions apply.
Ranking: The shortest program wins this code-golf.