I think boolean res2 is the problem here, can you guide me what is the mistake here
Subset sum easy
Your code will return true for all cases because it will consider the empty subset to be with sum 0. You could correct it using either of these two approaches:
1] Calculate the total number of subsets with zero sum and check if it is greater than or equal to 1.
2] Send a flag to indicate that atleast an element has been taken or not. Return true only if sum equals to 0 and flag is 1.