Skip to content

Latest commit

 

History

History

Next Greater Element

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Problem Statment

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 the right side of x in the array. Elements for which no greater element exist, consider the next greater element as -1.

Screenshot 2021-10-04 at 10 30 33 PM

Time Complexity

Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N)