General Motors (GM) Interview Question

I was given a simple array sorting challenge