Pergunta de entrevista da empresa Globant

How to implement 2D matrix with code and How the code can be optimized?