Pergunta de entrevista da empresa ACKO General Insurance

sorting an array of strings with certain conditons