Pergunta de entrevista da empresa Broadridge

They asked me a 2d matrix DSA question which could be solved with pattern recognition.