Which number sum is close to a given value (less than or equal to)

  node.js, question

In life, there is often such a situation:

Online shopping, a fixed coupon 1000, there are many commodities with different unit prices, 101,230,330,210,299, …
How can we use this 1000 yuan as much as possible?

This is just an example. I don’t know how to express it when I translate it into a description of computer science.
For example:Which number sum is close to a given value (less than or equal to)

What kind of algorithm should be used for such a business logic? No language. (c,php,java,node)

This kind of problem belongs toKnapsack problemCategory, can be usedgreedy algorithmTo solve.