You are given an array A[] having N elements and a number K. You 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 answer will be 2.

i.e., ({3,4}, {7}) and ({7}, {3,4})

How can I solve this optimally?