Pergunta de entrevista da empresa Samsung Electronics

Next highest element for all the elements in the array