#K82567. Maximum Subarray Sum
Maximum Subarray Sum
Maximum Subarray Sum
Given an array of integers, your task is to compute the maximum sum of any contiguous subarray. This is a classic problem that can be efficiently solved using Kadane's algorithm. Formally, given an array \(A = [a_1, a_2, \ldots, a_n]\), you are to find the maximum value of \(\sum_{i=l}^{r} a_i\) for some indices \(1 \leq l \leq r \leq n\).
The input is provided via standard input where the first line contains a single integer \(n\) (the number of elements in the array) followed by a line with \(n\) space-separated integers. The output should be the maximum subarray sum printed to standard output.
inputFormat
The first line contains a single integer \(n\) indicating the number of elements. The second line contains \(n\) space-separated integers representing the array elements.
outputFormat
Output a single integer representing the maximum subarray sum.
## sample5
1 2 3 4 -10
10