let arr = [2,2,2,2,2,2,2,2,2,2];
let resCount = 0;
let resArr = [];
dfs(23,arr,[])
function dfs(n,arr,path){
if(n == 0 && path.length == 5){
resArr.push([...path]);
resCount += 1;
return;
}
if(n < 0) return;
if(path.length > 5) return;
for(let i = 0;i <= 9;i++){
if(arr[i] > 0){
path.push(i);
arr[i] -= 1;
dfs(n - i,arr,path);
path.pop(i);
arr[i] += 1;
}
}
}
console.log(resArr);
console.log(resCount)
let map = new Map();
resArr.forEach(item=>{
item.sort((a,b)=>a-b);
map.set(item.join(),item);
})
console.log([...Array.from(map.values())])
console.log(map.size)
console