Given an array of integers A and a target value val, find all unique combinations of integers from A where their sum is equal to val.
Note: Each integer in the array may be used once in the combination.
A: [10, 1, 2, 7, 6, 1, 5]
val: 8
Combinations: [
[1, 1, 6],
[1, 2, 5],
[1, 7],
[2, 6]
]
The first line contains an integer ‘T’, denoting the number of test cases.
For each test case the input has three lines:
For each test case, the output has the following lines:
3
7
10 1 2 7 6 1 5
8
4
1 2 3 2
4
5
1 2 3 4 5
5
4
1 1 6
1 2 5
1 7
2 6
2
1 3
2 2
3
1 4
2 3
5
1 <= T <= 10
1 <= n <= 30
1 <= target <= 500
1 <= Ai <= 500