The matrix sort problem

The matrix sort problem entails sorting based on a column in ascending or descending fashion while ensuring the order of the elements with respect to other rows, respectively.

Sample program


Matrix :
		  4  3  2  1  5
		  5  2  5  4  6
		  1  2  3  5  7
		  8  9  6  3  2
		  1  3  5  7  9

Matrix Sort (based on the last column)
		  8  9  6  3  2
		  4  3  2  1  5
		  5  2  5  4  6
		  1  2  3  5  7
		  1  3  5  7  9

Get hands-on with 1200+ tech skills courses.