Skip to main content
deleted 1 character in body
Source Link
l4m2
  • 28.3k
  • 2
  • 25
  • 103

JavaScript (V8), 9291 bytes

f=([c,...x],s,n=R=[])=>1/n[4]?s||R[n.sort()]||print(R[n]=n):1/c?fc&&f(x,s,n)^f(x,s-c,[...n,c]):x

Try it online!Try it online!

JavaScript (Node.js), 97 bytes

f=([c,...x],s,n=R=[])=>1/n[4]?s||R[n.sort()]?[]:[R[n]=n]:1/c?[...f(x,s,n),...f(x,s-c,[...n,c])]:x

Try it online!

JavaScript (Node.js), 98 bytes

f=(x,s,i=R={},...n)=>1/n[4]?s||R[n.sort()]?[]:[R[n]=n]:x.flatMap((e,j)=>i<=j?[]:f(x,s-e,j,...n,e))

Try it online!

Dedup

JavaScript (V8), 92 bytes

f=([c,...x],s,n=R=[])=>1/n[4]?s||R[n.sort()]||print(R[n]=n):1/c?f(x,s,n)^f(x,s-c,[...n,c]):x

Try it online!

JavaScript (Node.js), 97 bytes

f=([c,...x],s,n=R=[])=>1/n[4]?s||R[n.sort()]?[]:[R[n]=n]:1/c?[...f(x,s,n),...f(x,s-c,[...n,c])]:x

Try it online!

JavaScript (Node.js), 98 bytes

f=(x,s,i=R={},...n)=>1/n[4]?s||R[n.sort()]?[]:[R[n]=n]:x.flatMap((e,j)=>i<=j?[]:f(x,s-e,j,...n,e))

Try it online!

Dedup

JavaScript (V8), 91 bytes

f=([c,...x],s,n=R=[])=>1/n[4]?s||R[n.sort()]||print(R[n]=n):1/c&&f(x,s,n)^f(x,s-c,[...n,c])

Try it online!

JavaScript (Node.js), 97 bytes

f=([c,...x],s,n=R=[])=>1/n[4]?s||R[n.sort()]?[]:[R[n]=n]:1/c?[...f(x,s,n),...f(x,s-c,[...n,c])]:x

Try it online!

JavaScript (Node.js), 98 bytes

f=(x,s,i=R={},...n)=>1/n[4]?s||R[n.sort()]?[]:[R[n]=n]:x.flatMap((e,j)=>i<=j?[]:f(x,s-e,j,...n,e))

Try it online!

Dedup

added 1036 characters in body
Source Link
l4m2
  • 28.3k
  • 2
  • 25
  • 103

JavaScript (V8), 92 bytes

f=([c,...x],s,n=R=[])=>1/n[4]?s||R[n.sort()]||print(R[n]=n):1/c?f(x,s,n)^f(x,s-c,[...n,c]):x

Try it online!

JavaScript (Node.js), 97 bytes

f=([c,...x],s,n=R=[])=>1/n[4]?s||R[n.sort()]?[]:[R[n]=n]:1/c?[...f(x,s,n),...f(x,s-c,[...n,c])]:x

Try it online!

JavaScript (Node.js), 98 bytes

f=(x,s,i=R={},...n)=>1/n[4]?s||R[n.sort()]?[]:[R[n]=n]:x.flatMap((e,j)=>i<=j?[]:f(x,s-e,j,...n,e))

Try it online!

Dedup

JavaScript (Node.js), 98 bytes

f=(x,s,i=R={},...n)=>1/n[4]?s||R[n.sort()]?[]:[R[n]=n]:x.flatMap((e,j)=>i<=j?[]:f(x,s-e,j,...n,e))

Try it online!

Dedup

JavaScript (V8), 92 bytes

f=([c,...x],s,n=R=[])=>1/n[4]?s||R[n.sort()]||print(R[n]=n):1/c?f(x,s,n)^f(x,s-c,[...n,c]):x

Try it online!

JavaScript (Node.js), 97 bytes

f=([c,...x],s,n=R=[])=>1/n[4]?s||R[n.sort()]?[]:[R[n]=n]:1/c?[...f(x,s,n),...f(x,s-c,[...n,c])]:x

Try it online!

JavaScript (Node.js), 98 bytes

f=(x,s,i=R={},...n)=>1/n[4]?s||R[n.sort()]?[]:[R[n]=n]:x.flatMap((e,j)=>i<=j?[]:f(x,s-e,j,...n,e))

Try it online!

Dedup

added 4 characters in body
Source Link
l4m2
  • 28.3k
  • 2
  • 25
  • 103

JavaScript (Node.js), 98 bytes

f=(x,s,i=R={},...n)=>1/n[R[nn[4]?s||R[n.sort()]||4]?s]?[]:[R[n]=n]:x.flatMap((e,j)=>i<=j?[]:f(x,s-e,j,...n,e))

Try it online!Try it online!

Dedup

JavaScript (Node.js), 98 bytes

f=(x,s,i=R={},...n)=>1/n[R[n.sort()]||4]?s?[]:[R[n]=n]:x.flatMap((e,j)=>i<=j?[]:f(x,s-e,j,...n,e))

Try it online!

Dedup

JavaScript (Node.js), 98 bytes

f=(x,s,i=R={},...n)=>1/n[4]?s||R[n.sort()]?[]:[R[n]=n]:x.flatMap((e,j)=>i<=j?[]:f(x,s-e,j,...n,e))

Try it online!

Dedup

added 57 characters in body
Source Link
l4m2
  • 28.3k
  • 2
  • 25
  • 103
Loading
Source Link
l4m2
  • 28.3k
  • 2
  • 25
  • 103
Loading