Pergunta de entrevista da empresa TO THE NEW

There are two elements present in array ,sort it within one loop.