combine = (list, k) => {
let combinations = [];
const backtracking = (results, path, depth, options) => {
if (depth === 0) results.push([...path]);
else
options.forEach((num, index) => {
path.push(num);
backtracking(results, path, depth - 1, options.slice(index + 1));
path.pop();
});
};
backtracking(combinations, [], k, list);
return combinations;
}