[Solved] Quick and efficient permutations with max length
Vocabulary lesson: these are actually combinations, not permutations. With permutations, a different order is a different permutations. Also, what you want technically isn’t all combinations, as there is the empty combination [] and it seems you don’t want that included. Anyway, here’s something I whipped up. function getCombinations(array) { let combinations = []; for (let … Read more