combinationsWithRep
Calculate the number combinations in a population size n, whilst selecting k items
int combinationsWithRep(int n, int k);
will return the total number of unique combinations in a population size n
, whilst selecting k
items that can be repeated
. There is no custom return type, the function always returns an integer.
combinationsWithRep(4, 2); //10
combinationsWithRep(5, 3); //35
combinationsWithRep(3, 2); //6
Last updated