In this challenge you will take two inputs One input will be a string of numbers of any length which you will put into an array/table/whatever you call it in your language Ex:

10 10 145 20 53 102 20

Would become

arraynameofyourchoice = {10, 10, 145, 20, 53, 102, 20}

You can assume the input will have spaces in between each number and no newlines.

The second input will be our sum, which will be a number Ex:


Your challenge is to make a script that will search through your array and find every possible way to get 165 by adding numbers in the array. You can output your code in any way that clearly shows what numbers you are adding.

So in our example the output would be:

10, 10, 145
145, 20
53, 102, 10

Because each of those sequences of numbers added together equal 165

Note that even though there are 2 twenties in the sequence we did not output

145, 20

twice. You can never have a repeated sequence. Your code will take a +5 byte penalty if it does something like this:

145, 20
20, 145

This is fastest code challenge so fastest code wins! good luck!

  • \$\begingroup\$ If I changed this to a fastest code challenge would it still be a duplicate? \$\endgroup\$
    – user40734
    May 16, 2015 at 12:50
  • \$\begingroup\$ It's probably different then, but this needs some work to be a proper fastest code challenge. For a start the 5-byte penalty no longer makes sense. Furthermore, you'll have to run all submissions on your own machine, so that timings can be compared fairly. And lastly, you would have to include some large test sets that actually allow you to measure timings meaningfully. \$\endgroup\$ May 16, 2015 at 14:53