翻转一棵二叉树
链接
123456789
function invertTree(root: TreeNode | null): TreeNode | null { if (root === null) return root const temp = root.left root.left = root.right root.right = temp invertTree(root.left) invertTree(root.right) return root}