General Motors (GM) interview question

I was given a simple array sorting challenge