WLJS LogoWLJS Notebook

LongestCommonSubsequencePositions

LongestCommonSubsequencePositions[s1, s2] finds the longest contiguous subsequence of elements common to the strings or lists s1 and s2 and returns their positions {pos1, pos2} in s1 and s2.

Examples

LongestCommonSubsequencePositions["abcdefg", "xyzcdewq"]
(* {{3, 5}, {4, 6}} *)
LongestCommonSubsequencePositions[{a, b, c, d}, {x, b, c, y}]
(* {{2, 3}, {2, 3}} *)

Please visit the official Wolfram Language Reference for more details.

On this page