Pergunta de entrevista da empresa DP World

Rearrange array such that elements greater ar towards right and smaller toward left