[nb] Sync

This commit is contained in:
2022-02-20 21:55:27 -06:00
parent f9c2c88398
commit 3551467ef9
17 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
const RecPermute = (soFar, rest) => {
if (rest.length === 0) {
console.log('result', soFar);
console.log('\n\n');
} else {
for (let i = 0; i < rest.length; i++) {
const remaining = rest.substring(0,i) + rest.substring(i+1);
console.log('r', remaining)
console.log('R', rest);
console.log('SF', soFar);
console.log('------');
RecPermute(soFar + rest[i], remaining);
}
}
};
x = 'abc';
RecPermute('', x);