MCPcopy
hub / github.com/qiyuangong/leetcode / popMax

Method popMax

python/716_Max_Stack.py:45–56  ·  view source on GitHub ↗

:rtype: int

(self)

Source from the content-addressed store, hash-verified

43 return self.max_stack[-1]
44
45 def popMax(self):
46 """
47 :rtype: int
48 """
49 val = self.peekMax()
50 buff = []
51 while self.top() != val:
52 buff.append(self.pop())
53 self.pop()
54 while len(buff) != 0:
55 self.push(buff.pop(-1))
56 return val

Callers

nothing calls this directly

Calls 4

peekMaxMethod · 0.95
topMethod · 0.95
popMethod · 0.95
pushMethod · 0.95

Tested by

no test coverage detected