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.

Revisions

  1. zekhoi created this gist May 3, 2022.
    18 changes: 18 additions & 0 deletions bracketCombinations.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    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()));