I am trying to build a javascript function to get all combinations of size N from an array.
lets say I got:
const Xarray = ["19", "21","42","23", "25", "28"];
const n = 4;
combinationsOfN(Xarray, n) =>
[ ["19", "21", "42", "23"],
["19", "21", "42", "25"],
["19", "21", "42", "28"],
["19", "21", "23", "25"],
["19", "21", "23", "28"],
["19", "21", "25", "28"],
…. ]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…