Skip to content

Commit e4a7e2d

Browse files
committed
Update permutations & combinations
1 parent 8860d20 commit e4a7e2d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/combinatorics/combinations.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
return function (arr, k) {
1919
res = [];
2020
combinations(arr, k, 0, 0, []);
21-
return res;
21+
var temp = res;
22+
// Free the extra memory
23+
res = null;
24+
return temp;
2225
};
2326
}());
2427

src/combinatorics/permutations.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
return function (arr) {
3333
res = [];
3434
permutations(arr, 0);
35-
return res;
35+
var temp = res;
36+
// Free the extra memory
37+
res = null;
38+
return temp;
3639
};
3740
}());
3841

0 commit comments

Comments
 (0)