updated folder names

This commit is contained in:
alexchao26
2020-01-30 22:10:56 -05:00
parent f663b0e7c8
commit e8a8d9cb8c
21 changed files with 0 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
function makePerms(low, high) {
const digits = [];
for (let i = low; i <= high; i++) {
digits.push(i);
}
const allPerms = [];
function inner(digitsArr, perm = []) {
if (perm.length === 5) {
allPerms.push(perm);
} else {
digitsArr.forEach((digit, index) => {
inner(digitsArr.slice(0, index).concat(digitsArr.slice(index + 1)), perm.concat(digit))
})
}
}
inner(digits);
return allPerms;
}
console.log(makePerms(0, 4));