Pregunta de entrevista de Roblox

Processing a matrix for validity checking based on some rules.