Complete-Preparation

πŸŽ‰ One-stop destination for all your technical interview Preparation πŸŽ‰

View the Project on GitHub

Partition Equal Subset Sum 🌟🌟

Solution

bool canPartition(vector<int> &arr, int n)
{
    int sum = 0;
    for(int i = 0; i< n; i++){
        sum+=arr[i];
    }
    if(sum%2==1) return false;
    return subsetSumToK(n,sum/2,arr);
}