Find characters sequence in a puzzle word

Hello folks!

I have an array of string that represents a DNA sequence and I would like to check if it has a character sequence of 4 letters O, N or Z in any direction. As example, I have this array:

values = ["ZBNONO", "ZBONNZ", "BOBBNB", "ONONNN", "ZZZZBO", "BZOZBN"]

https://i.stack.imgur.com/2fuV8.png

I'm totally stuck to solve this problem and I would like to know what is the best algorithm to solve it.

To be a valid array, it must have more than 1 sequence of letters.

Any help, please?

Comments (1)