public int minSubArray_lint(ArrayList<Integer> nums) {
        // write your code
        if (nums == null || nums.size() == 0)
            return 0;
        int n = nums.size();
        int[] local = new int[n];
        int[] global = new int[n];
        local[0] = global[0] = nums.get(0);
        for (int i = 1; i < n; ++i) {
            int val = nums.get(i);
            local[i] = Math.min(local[i - 1] + val, val);
            global[i] = Math.min(global[i - 1], local[i]);
        }
        return global[n - 1];
    }