Pregunta de entrevista de Uber

Something to do with matrices and string manipulation. (Def leetcode medium)