2024/12/3 灵茶题单 dp
This commit is contained in:
parent
61bf855b75
commit
0784c9f188
|
@ -0,0 +1,16 @@
|
|||
package com.cool.ling_cha_mount.dp;
|
||||
|
||||
public class Num377 {
|
||||
public int combinationSum4(int[] nums, int target) {
|
||||
int[] dp=new int[target+1];
|
||||
dp[0]=1;
|
||||
for(int i=1;i<dp.length;i++){
|
||||
for(int num:nums){
|
||||
if(num<=i){
|
||||
dp[i]+=dp[i-num];
|
||||
}
|
||||
}
|
||||
}
|
||||
return dp[target];
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue