Blog Archives

An Easy DP Problem-2 with Bitmask

Given N integers. Let Total subsets T=2N. How many subsets are available from T where the distinct integers are less than or equal to K. Sample Input: 4 2 (N,K) 1 2 3 4(A[i]) Sample Output: 11 Sample Input: 4

Posted in Dynamic Programming

An Easy DP Problem-1

You are given an array a[] of length N. You have to output P such that p=summation of some array elements. An condition must be hold that is if you choose the i-th element of the array, then you mustn’t

Tagged with:
Posted in Dynamic Programming