def tree_mirror(node): if not node: return node.left, node.right = node.right, node.left tree_mirror(node.left) tree_mirror(node.right)
function treeMirror(node) { if (!node) { return; } let temp = node.left; node.left = node.right; node.right = temp; treeMirror(node.left); treeMirror(node.right); }
Last updated 3 years ago