Https://ide.codingblocks.com/s/185849

Find greate element problem. i try to solve it but stuck into errors .colud you please help me ?

@meetsoni01041996 try implementing it using stack.
and note one thing that given array is circular.

but using vector is it possible to solve?

Here if i used stack then what if greater element is present at last index ??

Here one more doubt
@sdevwrat
if test case is like
5
2 3 6 7 1

then what should be output??

answer for this will be
3 6 7 -1 2

travel the array from last to first and stack stores the indices of the appropriate elements from nums array. The top of the stack refers to the index of the Next Greater Element found so far.