MCPcopy
hub / github.com/Jack-Lee-Hiter/AlgorithmsByPython / pop

Method pop

Target Offer/用两个栈实现队列.py:12–18  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

10 def push(self, node):
11 self.stack1.append(node)
12 def pop(self):
13 if len(self.stack2) == 0 and len(self.stack1) == 0:
14 return
15 elif len(self.stack2) == 0:
16 while len(self.stack1) > 0:
17 self.stack2.append(self.stack1.pop())
18 return self.stack2.pop()
19
20P = Solution()
21P.push(10)

Callers 15

preOrderMethod · 0.45
inOrderMethod · 0.45
postOrderMethod · 0.45
preOrderMethod · 0.45
mirrorPreOrderMethod · 0.45
SerializeMethod · 0.45
TreeDepth2Method · 0.45
FirstAppearingOnceMethod · 0.45
widthOfTreeMethod · 0.45
PrintFromTopToBottomMethod · 0.45
Mirror2Method · 0.45
MirrorNoRecursionMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected