Subset sum problem: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: elided STYLE for the PRE HTML tag.) |
m (added whitespace and bullet points to the task's preamble, added a (bold) section (For example).) |
||
Line 1: | Line 1: | ||
{{draft task|Discrete math}} |
{{draft task|Discrete math}} |
||
;Task: |
;Task: |
||
Implement a function/procedure/method/subroutine that takes a set/array/list/stream/table/collection of words with integer weights, and identifies a non-empty subset of them whose weights sum to zero (cf. the Dropbox [http://www.dropbox.com/jobs/challenges Diet] candidate screening exercise and the [[wp:Subset sum problem|Subset sum problem]] Wikipedia article). |
Implement a function/procedure/method/subroutine that takes a set/array/list/stream/table/collection of words with integer weights, and identifies a non-empty subset of them whose weights sum to zero (cf. the Dropbox [http://www.dropbox.com/jobs/challenges Diet] candidate screening exercise and the [[wp:Subset sum problem|Subset sum problem]] Wikipedia article). |
||
:for example: |
|||
This set of weighted words, one solution would be the set of words: |
|||
:::* {elysee, efferent, deploy, departure, centipede, bonnet, balm, archbishop} |
|||
because their respective weights of: |
|||
:::* -326, 54, 44, 952, -658, 452, 397, and -915 |
|||
sum to zero. |
|||
⚫ | |||
For example, for this set of weighted words, one solution would be the set of words {elysee, efferent, deploy, departure, centipede, bonnet, balm, archbishop}, because |
|||
their respective weights of -326, 54, 44, 952, -658, 452, 397, and -915 sum to zero. |
|||
⚫ | |||
|+ Table of weighted words |
|+ Table of weighted words |
||
|- style="background-color: rgb(255, 204, 255);" |
|- style="background-color: rgb(255, 204, 255);" |