Algorithms find the most frequently occurring sequence of strings of length 3

Viewed 2800

"Given multiple name arrays, find the most frequently occurring sequence of names of length 3(sequence of length 3), if it exists"

Eg: Given 3 name arrays:

Ana John Maria
Paul
Sharon Ana John Maria Tiffany Ted

The output will be Ana John Maria since this sequence is encountered twice, in the first and the 3rd array.

i can't seem to find a correct solution for this.

Can anyone point me in the right direction? Maybe it's a well known algorihm for this. Can anyone give me a link? Thanks

2 Answers
Related