题目:
题解:
func combinationSum4(nums []int, target int) int {dp := make([]int, target+1)dp[0] = 1for i := 1; i <= target; i++ {for _, num := range nums {if num <= i {dp[i] += dp[i-num]}}}return dp[target]
}
题目:
题解:
func combinationSum4(nums []int, target int) int {dp := make([]int, target+1)dp[0] = 1for i := 1; i <= target; i++ {for _, num := range nums {if num <= i {dp[i] += dp[i-num]}}}return dp[target]
}