feat: added 03_dom
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
@@ -36,7 +36,17 @@
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
const combinations = (n, k) => {};
|
||||
const combinations = (n, 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
|
||||
console.log(combinations(5, 2)); // => 10
|
||||
|
||||
Reference in New Issue
Block a user