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
11 changes: 9 additions & 2 deletions data_structures/stacks/next_greater_element.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Function to print element and NGE pair for all elements of list
def printNGE(arr):

"""
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
>>> printNGE([11,13,21,3])
11 -- 13
13 -- 21
21 -- -1
3 -- -1
"""
for i in range(0, len(arr), 1):

next = -1
Expand Down