Pregunta de entrevista de Uber

I was asked a technical coding question involving a 2D-array (matrix).