Computing Longest (Common) Lyndon Subsequences - Bannai, Hideo; I, Tomohiro; Kociumaka, Tomasz; Köppl, Dominik; Puglisi, Simon J. (Combinatorial Algorithms, 2022)
Given a string T with length n whose characters are drawn from an ordered alphabet of size σ $$σ $$ , its longest Lyndon subsequence is a longest subsequence of T that is a Lyndon word. We propose algorithms for finding such a subsequence in O(n3) $$\mathcal {O}(n^3)$$ time with O(n) $$\mathcal {O}(n)$$ space, or online in O(n3σ) $$\mathcal {O}(n^3 σ )$$ space and time. Our first result can be extended to find the longest common Lyndon subsequence of two strings of length n in O(n4σ) $$\mathcal {O}(n^4 σ )$$ time using O(n3) $$\mathcal {O}(n^3)$$ space.