American Express interview question

a simple sorting algorithm