You are viewing a single comment's thread. Return to all comments →
def getMax(operations): stack = [0] my = [] for i in operations: if int(i[0]) == 1: n = int(i[2:]) stack.append(max(n,stack[-1])) elif int(i[0]) == 2: if stack: stack.pop() else: my.append(stack[-1]) return my
Maximum Element
You are viewing a single comment's thread. Return to all comments →
PY3