BETA

Difficulty Level: Medium

Submissions: 1709 Accuracy:

38.39%

Perfect Sum Problem
     

Given an array of integers and a sum, the task is to count all subsets of given array with sum equal to given sum.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an nteger n denoting the size of the array. The next line contains n space separated integers forming the array. The last line contains the sum.

Output:
Count all the subsets of given array with sum equal to given sum.

Constraints:
1<=T<=10^5
1<=n<=10^5
1<=a[i]<=10^5
1<=sum<=10^5

Example:
Input:

2
6
2 3 5 6 8 10
10
5
1 2 3 4 5
10

Output:
3
3

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Govil

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.