問題:
How would you go about testing all possible combinations of additions from a given set N
of numbers so they add up to a given final number?您將如何測試給定N
組數字中所有可能的加法組合,以便將它們加起來爲給定的最終數字?
A brief example:一個簡單的例子:
- Set of numbers to add:
N = {1,5,22,15,0,...}
要添加的一組數字:N = {1,5,22,15,0,...}
- Desired result:
12345
預期結果:12345
解決方案:
參考一: https://stackoom.com/question/JR4s參考二: Finding all possible combinations of numbers to reach a given sum