Skip to content

Added more details about the problem statement #1367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Oct 18, 2019
Merged
10 changes: 9 additions & 1 deletion data_structures/stacks/next_greater_element.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Function to print element and NGE pair for all elements of list
# Function to print element and Next Greatest Element (NGE) pair for all elements of list
# NGE - Maximum element present afterwards the current one which is also greater than current one
def printNGE(arr):

for i in range(0, len(arr), 1):
Expand All @@ -13,5 +14,12 @@ def printNGE(arr):


# Driver program to test above function
'''
For the given list the ouput should be something like this:
11 -- 21
13 -- 21
21 -- -1
3 -- -1
'''
arr = [11, 13, 21, 3]
printNGE(arr)