This commit is contained in:
Philippe Torrel
2026-09-23 10:47:07 +02:00
parent b16dd8458d
commit 082a9bd7b3
11 changed files with 209 additions and 18 deletions
@@ -40,7 +40,13 @@
'use strict';
const combinations = (n, k) => {
// combinations(n - 1, k - 1) + combinations(n - 1, k);
if (k === 0 || k === n) {
return 1;
}
if (k > n) {
return 0;
}
return combinations(n - 1, k - 1) + combinations(n - 1, k);
};
// Test Cases