Question d’entretien chez Uber

Given a matrix, Sort and reverse the outer loops