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:
Wolfram Research (2015), LongestOrderedSequence, Wolfram Language function, https://reference.wolfram.com/language/ref/LongestOrderedSequence.html.
Wolfram Language. 2015. "LongestOrderedSequence." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/LongestOrderedSequence.html.
Wolfram Language. (2015). LongestOrderedSequence. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LongestOrderedSequence.html