Pregunta de entrevista de Samsung Electronics

Next highest element for all the elements in the array