function findCombimation(arr, num, type) {
if (num === 1) return arr.map((e) => [e]);
const result = [];
arr.forEach((fixed, index) => {
const a = arr.slice(index + 1);
const childComb = findCombimation(a, num - 1);
childComb.map((e) => result.push([fixed, ...e]));
});
return result;
}
function findPermutation(arr, num) {
if (num === 1) return arr.map((e) => [e]);
const result = [];
arr.forEach((fixed, index) => {
const a = [...arr];
a.splice(index, 1);
const childPermut = findPermutation(a, num - 1);
childPermut.map((e) => result.push([fixed, ...e]));
});
return result;
}