Skip to main content
Commonmark migration
Source Link

#JavaScript (ES6),  79  77 bytes

JavaScript (ES6),  79  77 bytes

Takes input as (B)(A), where \$B\$ is a list of sets and \$A\$ is a list of lists. Returns a falsy value (false or undefined) if \$A\preceq B\$, or true otherwise.

B=>g=([a,...A],u)=>a&&B.every((b,i)=>u>>i&1|a.some(v=>!b.has(v))|g(A,u|1<<i))

Try it online!

#JavaScript (ES6),  79  77 bytes

Takes input as (B)(A), where \$B\$ is a list of sets and \$A\$ is a list of lists. Returns a falsy value (false or undefined) if \$A\preceq B\$, or true otherwise.

B=>g=([a,...A],u)=>a&&B.every((b,i)=>u>>i&1|a.some(v=>!b.has(v))|g(A,u|1<<i))

Try it online!

JavaScript (ES6),  79  77 bytes

Takes input as (B)(A), where \$B\$ is a list of sets and \$A\$ is a list of lists. Returns a falsy value (false or undefined) if \$A\preceq B\$, or true otherwise.

B=>g=([a,...A],u)=>a&&B.every((b,i)=>u>>i&1|a.some(v=>!b.has(v))|g(A,u|1<<i))

Try it online!

saved 2 bytes
Source Link
Arnauld
  • 197.7k
  • 20
  • 179
  • 650

#JavaScript (ES6), 79 79  77 bytes

Takes input as (B)(A), where \$B\$ is a list of sets and \$A\$ is a list of lists. Returns a Booleanfalsy value (false or undefined) if \$A\preceq B\$, or true otherwise.

B=>g=([a,...A],u)=>!a||B=>a&&B.someevery((b,i)=>u^(v=u|1<<i)&&a=>u>>i&1|a.everysome(v=>bv=>!b.has(v))&g|g(A,vu|1<<i))

Try it online!Try it online!

#JavaScript (ES6), 79 bytes

Takes input as (B)(A), where \$B\$ is a list of sets and \$A\$ is a list of lists. Returns a Boolean value.

B=>g=([a,...A],u)=>!a||B.some((b,i)=>u^(v=u|1<<i)&&a.every(v=>b.has(v))&g(A,v))

Try it online!

#JavaScript (ES6),  79  77 bytes

Takes input as (B)(A), where \$B\$ is a list of sets and \$A\$ is a list of lists. Returns a falsy value (false or undefined) if \$A\preceq B\$, or true otherwise.

B=>g=([a,...A],u)=>a&&B.every((b,i)=>u>>i&1|a.some(v=>!b.has(v))|g(A,u|1<<i))

Try it online!

Source Link
Arnauld
  • 197.7k
  • 20
  • 179
  • 650

#JavaScript (ES6), 79 bytes

Takes input as (B)(A), where \$B\$ is a list of sets and \$A\$ is a list of lists. Returns a Boolean value.

B=>g=([a,...A],u)=>!a||B.some((b,i)=>u^(v=u|1<<i)&&a.every(v=>b.has(v))&g(A,v))

Try it online!