Skip to content

Instantly share code, notes, and snippets.

@zekhoi
Created May 3, 2022 14:10
Show Gist options
  • Save zekhoi/f85e41665ec05c7f399fa852d851a611 to your computer and use it in GitHub Desktop.
Save zekhoi/f85e41665ec05c7f399fa852d851a611 to your computer and use it in GitHub Desktop.
Coderbyte - Bracket Combinations
function BracketCombinations(num) {
// code goes here
const factorial = (number) => {
let k = 1
for(let i = number; i >= 1; i--){
k *= i;
}
return k
}
const finalresult = factorial(2 * num) / (factorial(num + 1) * factorial(num))
return finalresult;
}
// keep this function call here
console.log(BracketCombinations(readline()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment