Skip to main content
7 of 7
added 139 characters in body

Jelly, 9 bytes

ɓḟŒPḊ§iµƇ

Try it online!

Essentially, we go over each element, x, of the input, L, and keep it if:

  • We remove x from the input, call that L'
  • We then get all non-empty subsets of L', and get the sums of each
  • Finally, if x is in these sums, we keep it

If 0 is not considered the sum of the empty list, then +1 byte

How it works

ɓḟŒPḊ§iµƇ - Main link. Takes a list L on the left
ɓ      µ  - Group the links between ɓ and µ into a dyad f(L, x):
 ḟ        -   Remove x from L, L'
  ŒP      -   Powerset of L'
    Ḋ     -   Remove the leading empty array
     §    -   Sums of each
      i   -   Index of x, or 0 if not present
        Ƈ - For each element, x, of L, keep it if f(L, x) is true