Pergunta de entrevista da empresa Valeo

I was asked to write a function to sort values in an array in ascending/descending order.