Why is test code passing for first logic and not for other

https://ide.codingblocks.com/s/444288 Failing for this
https://ide.codingblocks.com/s/444287 passed for this

hello @pranjuldwivedi120568

both the approaches are wrong.
a)
all u r looking is adjacent elements , next greater element need not to be in immediate right, it can occur after some elements
b) the given array is circular
consider this case->
3
1 3 2
answer should be
3 -1 3

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.