MCPcopy
hub / github.com/HuberTRoy/leetCode / reverseStack

Function reverseStack

Stack/ReverseAStackByRecursive.py:12–25  ·  view source on GitHub ↗
(stacks)

Source from the content-addressed store, hash-verified

10
11
12def reverseStack(stacks):
13 new_stack = Stack()
14
15 def helper(stacks):
16 if stacks.empty():
17 return
18
19 new_stack.push(stacks.pop())
20
21 helper(stacks)
22
23 helper(stacks)
24
25 return new_stack
26
27# 测试用例。
28a = range(10)

Callers 1

Calls 2

StackClass · 0.90
helperFunction · 0.70

Tested by

no test coverage detected