RangeReplaceableCollection

public extension RangeReplaceableCollection

An extension of RangeReplaceableCollection, which calculates the longest common subsequence between two collections.

  • Returns the longest common subsequence between two collections.

    Declaration

    Swift

    func longestCommonSubsequence(_ collection: Self, by areEquivalent: (Element, Element) -> Bool) -> Self

    Parameters

    collection

    The collection with which to compare the receiver.

    areEquivalent

    A closure that returns a Boolean value indicating whether two elements are equivalent.

    Return Value

    The longest common subsequence between the receiver and the given collection.

  • Returns the longest common subsequence between two collections.

    Declaration

    Swift

    func longestCommonSubsequence(_ collection: Self) -> Self

    Parameters

    collection

    The collection with which to compare the receiver.

    Return Value

    The longest common subsequence between the receiver and the given collection.