Pergunta de entrevista da empresa Microsoft

Find out all strings from a grid and compare with a list, traversal is random