We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
def getMax(operations):
s = []
p = []
for i in range(n):
s.append(str(ops[i]).split(' '))
if s[i][0] == '1':
p.append(int(s[i][1]))
if s[i][0] == '2':
p.pop()
if s[i][0] == '3':
print(max(p))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Maximum Element
You are viewing a single comment's thread. Return to all comments →
En Python
def getMax(operations): s = [] p = [] for i in range(n): s.append(str(ops[i]).split(' ')) if s[i][0] == '1': p.append(int(s[i][1])) if s[i][0] == '2': p.pop() if s[i][0] == '3': print(max(p))