Uber Interview Question

Standard LC-styled matrix manipulation question.