How can I approach Uva 624 Uva 624 . Simplified Problem Statement: A set S={a,b,c,x,y} is given and a target sum is given so we have to find the elements which sums to the target sum or even very close to it. I think its a DP problem but I don't know how to approach it so giving the algorithm and explanation would be very nice.