Amazon interview question

They asked a leet code style matrix operation question.