#JavaScript (ES6), (削除) 84 60 (削除ここまで) 58 bytes
JavaScript (ES6), (削除) 84 60 (削除ここまで) 58 bytes
Ignores \$d\$. Returns \0ドル\$ if there's no solution.
f=([v,...a],x,o=[])=>x<1?o:v?f(a,x,o)||f(a,x^v,[...o,v]):0
###Commented
Commented
f = ( // f is a recursive function taking:
[v, // v = next value from the input set
...a], // a[] = array of remaining values
x, // x = 'XOR total', initially undefined
o = [] // o[] = output subset
) => //
x < 1 ? // if x is defined and equal to 0:
o // success: return o[]
: // else:
v ? // if v is defined:
f(a, x, o) || // try a recursive call where v is ignored
f(a, x ^ v, [...o, v]) // try a recursive call where v is used
: // else:
0 // failed
#JavaScript (ES6), (削除) 84 60 (削除ここまで) 58 bytes
Ignores \$d\$. Returns \0ドル\$ if there's no solution.
f=([v,...a],x,o=[])=>x<1?o:v?f(a,x,o)||f(a,x^v,[...o,v]):0
###Commented
f = ( // f is a recursive function taking:
[v, // v = next value from the input set
...a], // a[] = array of remaining values
x, // x = 'XOR total', initially undefined
o = [] // o[] = output subset
) => //
x < 1 ? // if x is defined and equal to 0:
o // success: return o[]
: // else:
v ? // if v is defined:
f(a, x, o) || // try a recursive call where v is ignored
f(a, x ^ v, [...o, v]) // try a recursive call where v is used
: // else:
0 // failed
JavaScript (ES6), (削除) 84 60 (削除ここまで) 58 bytes
Ignores \$d\$. Returns \0ドル\$ if there's no solution.
f=([v,...a],x,o=[])=>x<1?o:v?f(a,x,o)||f(a,x^v,[...o,v]):0
Commented
f = ( // f is a recursive function taking:
[v, // v = next value from the input set
...a], // a[] = array of remaining values
x, // x = 'XOR total', initially undefined
o = [] // o[] = output subset
) => //
x < 1 ? // if x is defined and equal to 0:
o // success: return o[]
: // else:
v ? // if v is defined:
f(a, x, o) || // try a recursive call where v is ignored
f(a, x ^ v, [...o, v]) // try a recursive call where v is used
: // else:
0 // failed
#JavaScript (ES6), (削除) 84 60 (削除ここまで) 6058 bytes
Ignores \$d\$. Returns \0ドル\$ if there's no solution.
f=([v,...a],x,o=[])=>x<1?o:1/v?f(a,x,o)||f(a,x^v,[...o,v]):0
###Commented
f = ( // f is a recursive function taking:
[v, // v = next value from the input set
...a], // a[] = array of remaining values
x, // x = 'XOR total', initially undefined
o = [] // o[] = output subset
) => //
x < 1 ? // if x is defined and equal to 0:
o // success: return o[]
: // else:
1 / v ? // if v is defined:
f(a, x, o) || // try a recursive call where v is ignored
f(a, x ^ v, [...o, v]) // try a recursive call where v is used
: // else:
0 // failed
#JavaScript (ES6), (削除) 84 (削除ここまで) 60 bytes
Ignores \$d\$. Returns \0ドル\$ if there's no solution.
f=([v,...a],x,o=[])=>x<1?o:1/v?f(a,x,o)||f(a,x^v,[...o,v]):0
###Commented
f = ( // f is a recursive function taking:
[v, // v = next value from the input set
...a], // a[] = array of remaining values
x, // x = 'XOR total', initially undefined
o = [] // o[] = output subset
) => //
x < 1 ? // if x is defined and equal to 0:
o // success: return o[]
: // else:
1 / v ? // if v is defined:
f(a, x, o) || // try a recursive call where v is ignored
f(a, x ^ v, [...o, v]) // try a recursive call where v is used
: // else:
0 // failed
#JavaScript (ES6), (削除) 84 60 (削除ここまで) 58 bytes
Ignores \$d\$. Returns \0ドル\$ if there's no solution.
f=([v,...a],x,o=[])=>x<1?o:v?f(a,x,o)||f(a,x^v,[...o,v]):0
###Commented
f = ( // f is a recursive function taking:
[v, // v = next value from the input set
...a], // a[] = array of remaining values
x, // x = 'XOR total', initially undefined
o = [] // o[] = output subset
) => //
x < 1 ? // if x is defined and equal to 0:
o // success: return o[]
: // else:
v ? // if v is defined:
f(a, x, o) || // try a recursive call where v is ignored
f(a, x ^ v, [...o, v]) // try a recursive call where v is used
: // else:
0 // failed
#JavaScript (ES6), (削除) 84 (削除ここまで) 60 bytes
Ignores \$d\$. Returns \0ドル\$ if there's no solution.
f=([v,...a],x,o=[])=>x<1?o:1/v?f(a,x,o)||f(a,x^v,[...o,v]):0
###Commented
f = ( // f is a recursive function taking:
[v, // v = next value from the input set
...a], // a[] = array of remaining values
x, // x = 'XOR total', initially undefined
o = [] // o[] = output subset
) => //
x < 1 ? // if x is defined and equal to 0:
o // success: return o[]
: // else:
1 / v ? // if v is defined:
f(a, x, o) || // try a recursive call where v is ignored
f(a, x ^ v, [...o, v]) // try a recursive call where v is used
: // else:
0 // failed
#JavaScript (ES6), (削除) 84 (削除ここまで) 60 bytes
Ignores \$d\$. Returns \0ドル\$ if there's no solution.
f=([v,...a],x,o=[])=>x<1?o:1/v?f(a,x,o)||f(a,x^v,[...o,v]):0
#JavaScript (ES6), (削除) 84 (削除ここまで) 60 bytes
Ignores \$d\$. Returns \0ドル\$ if there's no solution.
f=([v,...a],x,o=[])=>x<1?o:1/v?f(a,x,o)||f(a,x^v,[...o,v]):0
###Commented
f = ( // f is a recursive function taking:
[v, // v = next value from the input set
...a], // a[] = array of remaining values
x, // x = 'XOR total', initially undefined
o = [] // o[] = output subset
) => //
x < 1 ? // if x is defined and equal to 0:
o // success: return o[]
: // else:
1 / v ? // if v is defined:
f(a, x, o) || // try a recursive call where v is ignored
f(a, x ^ v, [...o, v]) // try a recursive call where v is used
: // else:
0 // failed