Skip to content

feat: add binomial coefficient algorithm - #2013

Open
sarthakgupta1907-cell wants to merge 1 commit into
TheAlgorithms:masterfrom
sarthakgupta1907-cell:feat/maths-binomial-coefficient
Open

sarthakgupta1907-cell wants to merge 1 commit into
TheAlgorithms:masterfrom
sarthakgupta1907-cell:feat/maths-binomial-coefficient

Conversation

@sarthakgupta1907-cell

Copy link
Copy Markdown

Describe your change:

Add implementation of the binomial coefficient algorithm in Maths/BinomialCoefficient.js.

Calculates C(n,k) - the number of ways to choose k items from n items.

  • Example: binomialCoefficient(5, 2) => 10
  • Example: binomialCoefficient(10, 3) => 120
  • Example: binomialCoefficient(5, 0) => 1

Checklist:

  • I have read CONTRIBUTING. md.
  • This pull request is all my own work—I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new JavaScript files are placed inside an existing directory.
  • All filenames are in the format MyAlgorithmName.js -- PascalCase.
  • All new algorithms have a URL in their comments that points to Wikipedia or another similar explanation.
  • All new algorithms have tests, and the tests pass.
  • All code is formatted with npx standard --fix .

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants