File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
src/algorithms/sets/permutations Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -14,13 +14,14 @@ export default function permutateWithRepetitions(
14
14
// Init permutations array.
15
15
const permutations = [ ] ;
16
16
17
+ // Get smaller permutations.
18
+ const smallerPermutations = permutateWithRepetitions (
19
+ permutationOptions ,
20
+ permutationLength - 1 ,
21
+ ) ;
22
+
17
23
// Go through all options and join it to the smaller permutations.
18
24
permutationOptions . forEach ( ( currentOption ) => {
19
- const smallerPermutations = permutateWithRepetitions (
20
- permutationOptions ,
21
- permutationLength - 1 ,
22
- ) ;
23
-
24
25
smallerPermutations . forEach ( ( smallerPermutation ) => {
25
26
permutations . push ( [ currentOption ] . concat ( smallerPermutation ) ) ;
26
27
} ) ;
You can’t perform that action at this time.
<
538
svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-copy js-clipboard-copy-icon">
0 commit comments