Skip to main content
added 139 characters in body
Source Link

Jelly, 89 bytes

ɓḟŒP§iµƇɓḟŒPḊ§iµƇ

Try it online!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µƇɓḟŒ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

Jelly, 8 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 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'
    §    -   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

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
added 228 characters in body
Source Link

Jelly, 8 bytes

ḟŒP§iʋ@ƇɓḟŒP§iµƇ

Try it online!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 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ʋ@ƇɓḟŒP§iµƇ - Main link. Takes a list L on the left
 ɓ     µ Ƈ - Filter each element of L, x, onGroup the following:
     ʋ@  -   Grouplinks thebetween previousɓ 4and linksµ into a dyad f(L, x):
        -     Remove x from L, L'
 ŒP ŒP     -     Powerset of L'
   § §    -     Sums of each
    i i   -     Index of x, or 0 if not present
       Ƈ - For each element, x, of L, keep it if f(L, x) is true

Jelly, 8 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 subsets of L', and get the sums of each
  • Finally, if x is in these sums, we keep it

How it works

ḟŒP§iʋ@Ƈ - Main link. Takes a list L on the left
       Ƈ - Filter each element of L, x, on the following:
     ʋ@  -   Group the previous 4 links into a dyad f(L, x):
        -     Remove x from L, L'
 ŒP      -     Powerset of L'
   §     -     Sums of each
    i    -     Index of x, or 0 if not present

Jelly, 8 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 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'
    §    -   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
deleted 315 characters in body
Source Link

Jelly, 8 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 subsets of L', and get the sums of each
  • Finally, if x is in these sums, we keep it

How it works

ḟŒP§iʋ@Ƈ - Main link. Takes a list L on the left
       Ƈ - Filter each element of L, x, on the following:
     ʋ@  -   Group the previous 4 links into a dyad f(L, x):
ḟ        -     Remove x from L, L'
 ŒP      -     Powerset of L'
   §     -     Sums of each
    i    -     Index of x, or 0 if not present

Jelly, 8 bytes

ḟŒP§iʋ@Ƈ

Try it online!

How it works

ḟŒP§iʋ@Ƈ - Main link. Takes a list L on the left
       Ƈ - Filter each element of L, x, on the following:
     ʋ@  -   Group the previous 4 links into a dyad f(L, x):
ḟ        -     Remove x from L, L'
 ŒP      -     Powerset of L'
   §     -     Sums of each
    i    -     Index of x, or 0 if not present

Jelly, 8 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 subsets of L', and get the sums of each
  • Finally, if x is in these sums, we keep it

How it works

ḟŒP§iʋ@Ƈ - Main link. Takes a list L on the left
       Ƈ - Filter each element of L, x, on the following:
     ʋ@  -   Group the previous 4 links into a dyad f(L, x):
ḟ        -     Remove x from L, L'
 ŒP      -     Powerset of L'
   §     -     Sums of each
    i    -     Index of x, or 0 if not present
Post Undeleted by caird coinheringaahin g
deleted 315 characters in body
Source Link
Loading
Post Deleted by caird coinheringaahin g
added 13 characters in body
Source Link
Loading
added 313 characters in body
Source Link
Loading
Source Link
Loading