MCPcopy Index your code
hub / github.com/qiyuangong/leetcode / push

Method push

python/716_Max_Stack.py:10–22  ·  view source on GitHub ↗

:type x: int :rtype: void

(self, x)

Source from the content-addressed store, hash-verified

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 """

Callers 1

popMaxMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected