class Stack: def __init__(self): self.items = [] self.current_max = None def push(self, item): self.items.append(item) if self.current_max == None: self.current_max = item else: self.current_max = max(item, self.current_max) def pop(self): if self.items: self.items.pop() self.current_max = max(items) def getMax(self): if self.items: return self.current_max def isEmpty(self): return self.items == [] def peek(self): if self.items: return self.items[-1] def clear(self): self.items = [] self.current_max = None def __repr__(self): return str(self.items)