We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d9946c1 commit 59c6f4dCopy full SHA for 59c6f4d
src/algorithms/sets/permutations/permutateWithRepetitions.js
@@ -14,13 +14,14 @@ export default function permutateWithRepetitions(
14
// Init permutations array.
15
const permutations = [];
16
17
+ // Get smaller permutations.
18
+ const smallerPermutations = permutateWithRepetitions(
19
+ permutationOptions,
20
+ permutationLength - 1,
21
+ );
22
+
23
// Go through all options and join it to the smaller permutations.
24
permutationOptions.forEach((currentOption) => {
- const smallerPermutations = permutateWithRepetitions(
- permutationOptions,
- permutationLength - 1,
- );
-
25
smallerPermutations.forEach((smallerPermutation) => {
26
permutations.push([currentOption].concat(smallerPermutation));
27
});
0 commit comments