diff --git a/Problems and General Algos/EqualSubset.cpp b/Problems and General Algos/EqualSubset.cpp new file mode 100644 index 0000000..8b690ac --- /dev/null +++ b/Problems and General Algos/EqualSubset.cpp @@ -0,0 +1,50 @@ +/* +Problem: To check if an array can be divided into two subarrays of equal sum +*/ + +#include +using namespace std; +bool canPartition(vector& nums) { + int sum = 0; + for(int i=0;i>n; + vectorvec(n); + for(int i=0;i>vec[i]; + if(canPartition(nums)) + cout<<"This array can be divided into 2 subarrays of equal sum"<