import { combinations } from "https://deno.land/x/masx200_leetcode_test@10.0.1/deps.ts";
Yields r
length Arrays
from the input iterable
. Order of selection does
not matter and elements are chosen without replacement.
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
import { combinations } from "https://deno.land/x/combinatorics/mod.ts";
const sequences = [...combinations([1, 2, 3, 4], 2)];
assertEquals(sequences, [
[1, 2],
[1, 3],
[1, 4],
[2, 3],
[2, 4],
[3, 4],
]);
Parameters
iterable: Iterable<T>