Pregunta de entrevista de Tata Consultancy Services

sort the array without sort I approached it in c++