Appearance
剑指Offer 27. 二叉树的镜像
DFS
js
/**
* Definition for a binary tree node.
* function TreeNode(val) {
* this.val = val;
* this.left = this.right = null;
* }
*/
/**
* @param {TreeNode} root
* @return {TreeNode}
*/
var mirrorTree = function(root) {
if (root === null) return null
let left = mirrorTree(root.left)
let right = mirrorTree(root.right)
root.right = left
root.left = right
return root
};