var invertTree = function(root) {
if(root === null){
return root
}
let tmpLeft = root.left;
root.left = root.right;
root.right = tmpLeft;
invertTree(root.left);
invertTree(root.right);
return root
};
leetcode 原题链接 https://leetcode-cn.com/problems/invert-binary-tree/submissions/
反转二叉树
网友评论