public class UberMath
extends java.lang.Object
| Constructor and Description |
|---|
UberMath() |
| Modifier and Type | Method and Description |
|---|---|
static int |
nChooseK(int n,
int k)
Calculate binomial coefficient for the specified n and k.
|
public static int nChooseK(int n,
int k)
Calculate binomial coefficient for the specified n and k.
In other words, for a set of specified size n method calculates number of possible distinct combinations of the specified size k.
Example, in the set [a, b, c] of size 3 - there're 3 possible combinations of size 2:
Note:
n - - size of a set. Required positive.k - - size of a combination. Required to be >= 0 and <= n.