:type x: int :rtype: void
(self, x)
| 8 | self.max_stack = [] |
| 9 | |
| 10 | def push(self, x): |
| 11 | """ |
| 12 | :type x: int |
| 13 | :rtype: void |
| 14 | """ |
| 15 | self.stack.append(x) |
| 16 | if len(self.max_stack) == 0: |
| 17 | self.max_stack.append(x) |
| 18 | return |
| 19 | if self.max_stack[-1] > x: |
| 20 | self.max_stack.append(self.max_stack[-1]) |
| 21 | else: |
| 22 | self.max_stack.append(x) |
| 23 | |
| 24 | def pop(self): |
| 25 | """ |