Pergunta de entrevista da empresa Meta

how would you write code to traverse a matrix