DEV Community

Discussion on: Daily Challenge #301 - Array Combos

Collapse
 
mbaas2 profile image
Michael Baas

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← {×/≢¨∪¨⍵} 
Enter fullscreen mode Exit fullscreen mode

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

Enter fullscreen mode Exit fullscreen mode

Try it online!