on-internet
← Community

Verify if a number X can be generated based on a combination of a series (a,b,c)

Stack Overflow ·

I'm going crazy trying to figure out a way to make a program that does not try every single combination. A simple example: I want to know if 11 can be generated by adding up numbers from the series (2,5,10,20), is there an easy way to do this without trying every single possibility? In this case we can do it with three 2s and one 5. Thanks

Comments

Sign in or sign up to comment and upvote.

No comments yet.