My Test Case 2 is wrong in Next Greater Element Problem

Why my testcase is wrong

Hey @shardul15
try for this input
5
7 3 4 5 2
correct output : -1 4 5 7 7
your code gives : 4 5 -1 -1 -1

@Monu-Singh-480654572341490 can you explain me how these output come

We are given a circular array, print the next greater number for every element. If it is not found print -1 for that number.
7 next Greater No one just print -1
3 next Greater 4
4 next Greater 5
5 next Greater 7
2 next Greater 7