Untitled
unknown
java
7 months ago
307 B
7
Indexable
Never
public static int valueOfNCR(int n, int r) { if (n == r) return 1; if (r == 1) return n; if (n == 0 || r == 0 || r > n) return 0; if (n == 1) return 1; return valueOfNCR(n - 1, r - 1) + valueOfNCR(n - 1, r); }
Leave a Comment