Minimum Subarray Sum
Find the minimum possible sum of a non-empty contiguous subarray.
Input: the first line has N; the second line has N integers.
Output: the minimum subarray sum.
Constraints:
- 1 ≤ N ≤ 105
- −109 ≤ ai ≤ 109
Sample Tests
Input 1
5 3 -4 2 -3 8
Output 1
-5
Input 2
2 5 6
Output 2
5
Discussion (opens after you solve — no spoilers before)
No comments yet.