public boolean groupSum(int start, int[] nums, int target) {
if(start>=nums.length&&target!=0)
return false;
if(target==0)
return true;
else
return groupSum(start+1,nums,target-nums[start])||groupSum(start+1,nums,
target);
}
public boolean groupSum6(int start, int[] nums, int target) {
if(start>=nums.length&&target!=0)
return false;
if(target==0&&start==nums.length)
return true;
if(nums[start]==6)
return groupSum6(start+1,nums,target-6);
else
return groupSum6(start+1,nums,target)||groupSum6(start+1,nums,target-nums[start]);
}
public boolean groupNoAdj(int start, int[] nums, int target) {
if(start>=nums.length&&target!=0)
return false;
if(target==0)
return true;
else
return groupNoAdj(start+2,nums,target-nums[start])||groupNoAdj(start+1,nums,target);
}
public boolean groupSum5(int start, int[] nums, int target) {
if(start>=nums.length&&target!=0)
return false;
if(start==nums.length&&target==0)
return true;
if(nums[start]%5==0){
if(start
else
return groupSum5(start+1,nums,target-nums[start]);}
else
return groupSum5(start+1,nums,target-nums[start])||groupSum5(start+1,nums,target);
}
public boolean groupSumClump(int start, int[] nums, int target) {
if(start>=nums.length&&target!=0)
return false;
if(start==nums.length&&target==0)
return true;
if(start
else
return groupSumClump(start+1,nums,target-nums[start])||groupSumClump(start+1,nums,target);
}
public boolean splitArray(int[] nums) {
return split(0,nums,0,0);
}
public boolean split(int start,int[]nums,int a,int b){
if(start>=nums.length&&a!=b)
return false;
if(start==nums.length&&a==b)
return true;
else
return split(start+1,nums,a+nums[start],b)||split(start+1,nums,a,b+nums[start]);
}
public boolean splitOdd10(int[] nums) {
return split(0,nums,0,0);
}
public boolean split(int start,int[]nums,int a,int b){
if(start==nums.length){
if(a%10==0&&b%2!=0)
return true;
else
return false;}
else
return split(start+1,nums,a+nums[start],b)||split(start+1,nums,a,b+nums[start]);
}
public boolean split53(int[] nums) {
return split(0,nums,0,0);
}
public boolean split(int start,int[] nums,int a,int b)
{
if(start==nums.length){
if(a==b)
return true;
else
return false;
}
else{
if(nums[start]%5==0)
return split(start+1,nums,a+nums[start],b);
else if(nums[start]%3==0)
return split(start+1,nums,a,b+nums[start]);
else
return split(start+1,nums,a+nums[start],b)||split(start+1,nums,a,b+nums[start]);
}
}