const cartesianProduct = (...args) => args.reduce((a, b) => a.map(x => b.map(y => x.concat([y]))).reduce((acc, t) => acc.concat(t), []) , [[]])
-
-
Save jkantr/0bd39a9d4feec00cee3835926649d838 to your computer and use it in GitHub Desktop.
Cartesian product of N arrays in Javascript
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment