Uber interview question

Standard LC-styled matrix manipulation question.