public ArrayList<Integer> subarraySumClosest_naive(int[] nums) {
        ArrayList<Integer> ans = new ArrayList<Integer>();
        if (nums == null || nums.length == 0)
            return ans;
        if (nums.length == 1) {
            ans.add(0);
            ans.add(0);
            return ans;
        }
        int[] sum = new int[nums.length];
        int prev = 0;
        for (int i = 0; i < nums.length; ++i) {
            sum[i] = prev + nums[i];
            prev += nums[i];
        }
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < nums.length; ++i) {
            for (int j = i; j < nums.length; ++j) {
                if (min > Math.abs(sum[j] - sum[i] + nums[i])) {
                    min = Math.abs(sum[j] - sum[i] + nums[i]);
                    ans.clear();
                    ans.add(i);
                    ans.add(j);
                    if (min == 0)
                        return ans;
                }
            }
        }
        return ans;
    }