Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

How to find the next greater element on array

Revision en1, by Darth, 2018-01-15 02:22:46

Hello guys.

I was trying to solve this problem by Just Contest 2.0, about to find the next greater element. For exemple:

Array = [1, 5, 4, 7, 9]

Ans = [5, 7, 7, 9, -1]

-The input is 105.

My solution:

Solution

My implementation:

Implementation

Someone can explain-me where I did wrong? Or my idea is not correct?

Thaks!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Darth 2018-01-15 02:22:46 1153 Initial revision (published)