how to change your life 7 facts or 5
Answers
Answered by
3
Answer:
Hello thanks for following me hope I can help u in questions
Answered by
1
Explanation:
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
World Languages,
3 hours ago
Science,
3 hours ago
Computer Science,
3 hours ago
Psychology,
5 hours ago
English,
5 hours ago
Math,
7 months ago
English,
7 months ago