Backtracking

Group Sum

Estimated reading: 1 minute 26 views
				
					public boolean groupSum(int start, int[] nums, int target) {
    if (start >= nums.length) {
        return target == 0;
    }

    if (groupSum(start + 1, nums, target - nums[start])) {
        return true;
    }

    if (groupSum(start + 1, nums, target)) {
        return true;
    }

    return false;
}
				
			
Share this Doc

Group Sum

Or copy link

CONTENTS