Amazon Interview Question

Oa question regarding reading 2d array and sorting it.