eBay Interview Question

One of the questions was Sorting a Diagonal Matrix.