📜  组合 sum iv leetcode - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:57.179000             🧑  作者: Mango

代码示例1
public int combinationSum4(int[] nums, int target) {
    if (target == 0) {
        return 1;
    }
    int res = 0;
    for (int i = 0; i < nums.length; i++) {
        if (target >= nums[i]) {
            res += combinationSum4(nums, target - nums[i]);
        }
    }
    return res;
}