Maximum Subarray Sum
InterviewTime limit1sMemory limit256 MB
For each test case, find the maximum sum over all contiguous subarrays of the given integer array.
- Level
Easy3 of 10
- Topics
- Dynamic programming, Array
- Solved
- No attempts yet
Problem
Given an integer array of size , find the maximum sum of any contiguous subarray. That is, compute .
Input
The first line contains the number of test cases . Each test case has one line with N$$(1 \le N \le 1000), then a line with integers separated by spaces, each with absolute value less than .
Output
For each test case, print the maximum subarray sum on its own line.