""" Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: a TreeNode, the root of the binary tree @return: nothing """ def invertBinaryTree(self, root): # write your code here if root is None: return None temproot = self.invertBinaryTree(root.left) root.left = self.invertBinaryTree(root.right) root.right = temproot return root
Python, LintCode, 175. 翻转二叉树
猜你喜欢
转载自blog.csdn.net/u010342040/article/details/80170488
今日推荐
周排行