groupSum6后向遍历

http://codingbat.com/prob/p199368

 

public boolean groupSum6(int start, int[] nums, int target) {
if( start >= nums.length){
return target==0;
}

if(nums[start]==6){

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

return false;


}

posted @ 2017-02-14 18:50  友哥  阅读(221)  评论(0编辑  收藏  举报