Count ordered pairs of disjoint subsets having sum greater than K.

77 Views Asked by At

You are given an array A[] having N elements and a number K. I have to count ordered pairs of disjoint non-empty subsets each having a sum greater than K.

For example,

N=3 and K=5

A = {3, 4, 7}

Then the solution will be 2. i.e, ({3,4}, {7}) and ({7}, {3,4})

How can I solve this optimally?