MCPcopy Create free account
hub / github.com/Jack-Lee-Hiter/AlgorithmsByPython / invertTree2

Method invertTree2

leetcode/226. Invert Binary Tree.py:34–37  ·  view source on GitHub ↗
(self, root)

Source from the content-addressed store, hash-verified

32 return root
33
34 def invertTree2(self, root):
35 if root:
36 root.left, root.right = self.invertTree(root.right), self.invertTree(root.left)
37 return root
38 # interative
39 def invertTreeInter(self, root):
40 stack = [root]

Callers

nothing calls this directly

Calls 1

invertTreeMethod · 0.95

Tested by

no test coverage detected