Answers for "bracket combinations"

0

bracket combinations

function BracketCombinations(num) { 
  return (1 / (num + 1)) * choose(2 * num, num);
}

function fact(num) {
  let sum = 1;
  for (let i = 1; i <= num; i++) {
    sum *= i;
  }
  return sum;
}

function choose(num, k) {
  return fact(num) / 2 * (fact(k) * 1 / fact(num - k));
}
Posted by: Guest on May-23-2021

Browse Popular Code Answers by Language