We're a place where coders share, stay up-to-date and grow their careers.
A solution in Dyalog APL: (In APL-Terminology, these "arrays" are called "vectors" and I'm using the default notation for 'em. It would also be possible to pass a JSON-Array, but that'd 5 more characters!)
solve← {×/≢¨∪¨⍵}
using it:
solve(1 2)(4)(5 6) 4 solve(1 2)(4)(5 5 6) 4 solve(1 2)(4 4)(5 6 6) 4 solve(1 2)(3 4)(5 6) 8 solve(1 2 3)(3 4 6 6 7)(8 9 10 12 5 6) 72
Try it online!
A solution in Dyalog APL:
(In APL-Terminology, these "arrays" are called "vectors" and I'm using the default notation for 'em. It would also be possible to pass a JSON-Array, but that'd 5 more characters!)
using it:
Try it online!