Skip to content

@technobuddha > library > Array > Analysis

Type Alias: LongestCommonSubsequenceOptions<T>

ts
type LongestCommonSubsequenceOptions<T> = {
  collect?: (this: void, i1: number, i2: number) => T;
  compare?: (this: void, a: T, b: T) => boolean;
};

Defined in: longest-common-subsequence.ts:9

Options for configuring the longestCommonSubsequence calculation.

Type Parameters

Type ParameterDescription
TType of objects in the arrays.

Properties

PropertyTypeDescriptionDefined in
collect?(this: void, i1: number, i2: number) => TFunction used to decide what to return as a result subsequence. It accepts 2 arguments: index of common element in the first array and index in the second. The default function returns element from the first array.src/longest-common-subsequence.ts:22
compare?(this: void, a: T, b: T) => booleanFunction that acts as a custom comparator for the array objects. Function should return true if objects are equal, otherwise false.src/longest-common-subsequence.ts:14