Please answer fast
For class 7 students
French.
Attachments:
Answers
Answered by
5
Answer:
It is class 12 not 7bbut be happy
Answered by
3
Answer:
int checkpar(int n ,int arr[], int sum , int csum,vector<vector>int dp){
if(dp[n][csum] ==-1){
if(n==0){
if(sum-csum==csum) return 1; else return 0; }
dp[n][csum]= checkpar(n-1,arr,sum ,csum,dp)+ checkpar(n-1,arr,sum,csum+arr[n-1],dp);
return dp[n][csum];
} else return dp[n][csum];
}
int equalPartition(int N, int arr[]) {
int sum=0;
for( int i=0;i<N;i++){ sum+=arr[i];
vector<vector<int>>dp(N+1,vector(sum+1,-1));
return checkpar(N,arr,sum,0,dp); }
Similar questions