Lc222_翻转二叉树
/**
*
* 反转二叉树 实际上就是反转每个节点下的叶子节点
* @param root
* @return
*/
public TreeNode invertTree(TreeNode root) {
if(root == null) {
return null;
}
TreeNode left = invertTree(root.left);
TreeNode right = invertTree(root.right);
root.left = right;
root.right = left;
return root;
}
不恋尘世浮华,不写红尘纷扰