Pregunta de entrevista de Amazon

Sorting based interview question in first round