Skip to content

combinationsWithReplacement

combinationsWithReplacement<T>(iterable: Iterable<T>, r: number): T[][]

Defined in: packages/pythonlib/src/itertools.ts:428

Return r-length combinations with replacement combinationsWithReplacement([1, 2, 3], 2) -> [[1, 1], [1, 2], [1, 3], [2, 2], [2, 3], [3, 3]]

Type Parameters

Type Parameter
T

Parameters

ParameterType
iterableIterable<T>
rnumber

Returns

T[][]