public boolean groupSumClump(int start, int[] nums, int target) {
if(start>=nums.length) return target==0;
int add=nums[start];
while(start<nums.length-1&&nums[start+1]==nums[start]){ add+=nums[start+1];start++;}
return groupSumClump(start+1,nums,target-add)||groupSumClump(start+1, nums,target);
}
if(start>=nums.length) return target==0;
int add=nums[start];
while(start<nums.length-1&&nums[start+1]==nums[start]){ add+=nums[start+1];start++;}
return groupSumClump(start+1,nums,target-add)||groupSumClump(start+1, nums,target);
}
Comments
Post a Comment