Next Geater Element
Given an array, print the Next Greater Element (NGE) for every element. The Next greater Element for an element x, is the first greater element on right side of x in the array. Elements for which no greater element exist, consider next greater element as -1.
Input format :
Line 1 : Size of input array
Line 2 : Array elements (separated by space)
Comments
Post a Comment