find out count of all subsets such that the sum of all the numbers in the subset is equal to target number. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

find out count of all subsets such that the sum of all the numbers in the subset is equal to target number.

input : [1,2,3,4,5] target : 5 output : [1,4] [2,3] [5] help with to write the program for this question in c c++ c# java (any language from this). help needed please.

18th Sep 2019, 11:02 AM
vivian
1 Answer
+ 7
Hi vivian You can show your try(code) you made to solve this problem to get better help from community. you need to generate all possible subsets(use of binary or a recursive program will be easy to think for it) & then look for sum of its elements.
18th Sep 2019, 11:09 AM
Gaurav Agrawal
Gaurav Agrawal - avatar