finds the longest ordered sequence of contiguous or disjoint elements in list.
finds the longest ordered sequence using the ordering function p.
Details and Options
- LongestOrderedSequence returns the longest common sequence, formed by contiguous or disjoint elements, with disjoint pieces concatenated.
- LongestOrderedSequence works on strings as well as lists.
- If there are several ordered sequences of the same length, LongestOrderedSequence returns the one that begins earliest in list.
- For strings, setting the option IgnoreCase->True makes LongestOrderedSequence treat lowercase and uppercase letters as equivalent, and return the form of sequence that occurs in s.
Examplesopen allclose all
Basic Examples (4)
By default, LongestOrderedSequence distinguishes lower case and upper case: