Skip to content

Instantly share code, notes, and snippets.

@DmitryMyadzelets
Last active September 23, 2017 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DmitryMyadzelets/b1e4444b3ddab8a3c4a46bbadd44f7d8 to your computer and use it in GitHub Desktop.
Save DmitryMyadzelets/b1e4444b3ddab8a3c4a46bbadd44f7d8 to your computer and use it in GitHub Desktop.
Combination
const factorial = (n) => n ? n * factorial(n - 1) : 1
// Given n, choose k - [Combination](https://en.wikipedia.org/wiki/Combination)
const C = (n, k) => factorial(n) / (factorial(k) * factorial(n-k))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment