Notwithstanding Precautions, Misadventure

    @lachenmayer/longest-common-subsequence

    1.0.1 • Public • Published

    longest-common-subsequence

    Finds the longest common subsequence of two strings, and the diff between them.

    function lcs(a: string, b: string): { lcs: string, diff: Array<Diff> }
     
    type Diff = 
      | ['keepOld', number] // index in a
      | ['addNew', number] // index in b
      | ['removeOld', number] // index in a

    Install

    npm i @lachenmayer/longest-common-subsequence

    DownloadsWeekly Downloads

    2

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    3.53 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar