Skip to content

Instantly share code, notes, and snippets.

@josfaber
Last active November 20, 2021 16:02
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 josfaber/68dede453ecaf9b577cd2cd7d85fc0f5 to your computer and use it in GitHub Desktop.
Save josfaber/68dede453ecaf9b577cd2cd7d85fc0f5 to your computer and use it in GitHub Desktop.
Number of possible combinations
/**
* returns the number of possible combinations for given number of participants
* (e.g. 6 soccer teams have to play 15 matches to have everyone playing every other once)
*/
function numCombinations(participants) {
return 0.5 * participants * (participants-1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment