You are viewing a single comment's thread. Return to all comments →
Short and simple without custom stack implemenatation.
#python 3 items = [0] for i in range(int(input())): nums = list(map(int, input().split())) if nums[0] == 1: items.append(max(nums[1], items[-1])) elif nums[0] == 2: items.pop() else: print(items[-1])
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 →
Short and simple without custom stack implemenatation.