Question d’entretien chez General Motors (GM)

I was given a simple array sorting challenge