1

I have an original order of numbers:

x = [2 6 4 3 6 3 4 6 2 6 3 4 2];

And I would like to compare a new vector of numbers:

y = [6 4 2 6 3 4 6 2 6 3 2 4 2 2 6 2];

to the original to get the longest consecutive string of similar numbers. So in the example above, the longest consecutive string will be

6 3 4 6 2 6 3

Thank you!

TYL
  • 1,577
  • 20
  • 33
  • This problem is known as the longest common substring. The best way to do this would be using dynamic programming. Read the duplicate I linked above to get started. Good luck! – rayryeng Sep 15 '16 at 06:53
  • Hi, thanks for letting me know about the duplication and sorry about it. Anyway, I have managed to write my own code with the help of another code written by someone else. Thanks! – TYL Sep 15 '16 at 07:53

0 Answers0