Number of ways of dividing an array into 2 parts such that sum of each part is > k

Revision en2, by DaviddeGea1, 2019-10-27 12:01:03

I got this problem in an off-campus round, someone please help me solve the problem:

You are given N elements, each having unique values. If you distribute them among 2 children in such a way that the total unique value that each child receives must be greater than K. How many ways can you distribute the elements so that the mentioned condition holds true?

Since the answer can be very large print it modulo 1e9+7.

1 <= N <= 10^3

1 <= K <= 10^5

1 <= A[i] <= 10^9

Sample Input:

3 5

3 7 4

Sample Output:

2 -> {3,4},{7} and {7},{3,4}

Tags #combinatorics, maths, #modular arithmetic

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English DaviddeGea1 2019-10-27 12:01:03 99
en1 English DaviddeGea1 2019-10-27 11:54:36 565 Initial revision (published)