k=length of each sequence

n=no of sequences

eg-

k=4

n=4

ABCD

BDAC

ABDC

BACD

ans is AC, BD

If the lengths of the strings are quite small (or equally, the number of strings if not), then yes it is possible. The dynamic programming algorithm for **N** strings is **O(N * n _{1} * n_{2} * … * n_{N} )** where

**n**is the length of the

_{i}**i’**string. Given

^{th}**N**\le

**1000**, the strings don’t have much independence to have a larger length as that would make the problem intractable (which is what it really is for an arbitrary number of strings)

Yes but for n=500 it won’t work XD

if all the subsequences are just permutations of the same string and the length is less enough, then you can apply DFS and find the longest path in the graph consisting of the elements of the sequence, and there’s an edge (i,j), if j is greater than i in each of the sequence.

See this problem and tutorial for reference

https://codeforces.com/problemset/problem/463/D