[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

(Solved) Java permutation algorithm

Your question is of mathematics nature – combinations and permutations. You are actually asking the number of possible permutation for string length 7. The formula is factorial(numOfchar). In this case 7! = 7x6x5x4x3x2x1 = 5040. public static void main(String[] args) { String str = “ABCDEFH”; System.out.println(“Number of permutations for ” + str + ” is … Read more