Pregunta de entrevista de Whole Foods Market

array sorting without using library, with few tweaks to question