public class Solution { /* * @param nums: a list of integers * @return: A integer indicate the sum of minimum subarray */ public int minSubArray(List<Integer> nums) { // write your code here if (nums == null) return 0; int minSum = Integer.MAX_VALUE; int maxSum = 0; int sum = 0; for (Integer num: nums) { sum += num; minSum = Math.min(minSum, sum - maxSum); maxSum = Math.max(maxSum, sum); } return minSum; } }