Pregunta de entrevista de ACKO General Insurance

sorting an array of strings with certain conditons