Problem Details
Find the smallest subset of balls whose weight is greater than the weight of the remaining balls.


You have 3 balls of weight 1, 2, and 3. You can take subset (1, 3) or (2, 3) as their total weight is greater than the weight of the remaining balls. The answer will be 2.

Green balls are taken in a subset.
You do not need to print anything; it has already been taken care of. Just implement the function.
The first line contains a single integer ‘t’ representing the number of test cases.
The first line of each test case contains a single integer ‘n’ representing the size of the array/list.
The second line and the last line of input contains ‘n’ single space-separated integers representing the array/list elements.
For each test case return the size of the smallest subset.
1 <= T <= 10
1 <= N <= 1000
1 <= ‘arr[i]’ <= 10^6
Where ‘T’ is the number of test cases.‘N’ is the number of elements in the array/list. ‘arr[i]’ is the weight of the ith ball.
Time Limit: 1sec
We have a simple recursion to solve this problem. Since the sum of all the balls remains constant we will just maintain the sum of weights of balls that we have taken in the subset.
We can declare ‘ans’, ‘arr’ and ‘totalSum’ as global variables.
We will define a recursive function with parameters ‘currIdx’, ‘totalSubsetSum’, and ‘ctr’.
Adding a ball to a subset increases subset size by 1.So it is optimal for us to choose the maximum weight ball which has not yet been taken into the subset. Therefore we are taking balls in our subset in order of decreasing weights. So we will arrange balls according to their weight using a sort function. Now iterate from the end (i.e. maximum weight). Add a current ball to ‘totalSubsetSum’ and increase counter i.e ans as the size of the subset increases. If this subset-sum is greater than the remaining elements break and come out of the loop and display the ans.
Following is the algorithm for this approach: