I was trying to solve a problem which is to verify that if there exist a sub sequence whose sum is equal to a given number. I found this thread Distinct sub sequences summing to given number in an array.
I don't have to solve it for all the possible sub sequence I just need is to verify. What is the most optimal algorithm to verify it.
e.g. a[]={8,1,2,5,4,7,6,3} and num=18
8+2+5+3 = 18