Find greate element problem. i try to solve it but stuck into errors .colud you please help me ?
Https://ide.codingblocks.com/s/185849
but using vector is it possible to solve?
Here if i used stack then what if greater element is present at last index ??
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.