Find the next greater element

I am getting WA for only one case. What’s that?

Hello @div_yanshu07 dry run your code for this test case:
4
8 2 3 6
you are not checking the array as in circular way:
correct output should be:
-1 3 6 8
Happy Learning!!