Last active
November 20, 2021 16:02
-
-
Save josfaber/68dede453ecaf9b577cd2cd7d85fc0f5 to your computer and use it in GitHub Desktop.
Number of possible combinations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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