Pregunta de entrevista de General Motors (GM)

I was given a simple array sorting challenge