Domanda di colloquio di Amazon

Oa question regarding reading 2d array and sorting it.