mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-09-20 07:43:04 +08:00
Merge branch 'master' into patch-1
This commit is contained in:
commit
5b24306e4f
@ -14,13 +14,14 @@ export default function permutateWithRepetitions(
|
||||
// Init permutations array.
|
||||
const permutations = [];
|
||||
|
||||
// Get smaller permutations.
|
||||
const smallerPermutations = permutateWithRepetitions(
|
||||
permutationOptions,
|
||||
permutationLength - 1,
|
||||
);
|
||||
|
||||
// Go through all options and join it to the smaller permutations.
|
||||
permutationOptions.forEach((currentOption) => {
|
||||
const smallerPermutations = permutateWithRepetitions(
|
||||
permutationOptions,
|
||||
permutationLength - 1,
|
||||
);
|
||||
|
||||
smallerPermutations.forEach((smallerPermutation) => {
|
||||
permutations.push([currentOption].concat(smallerPermutation));
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user