Tree: Depth-First Search - Invert Binary Tree
In the following code snippet for inverting a binary tree, which line causes the inversion to fail by not correctly swapping the children?
def invertTree(node):
if not node:
return None
invertTree(node.left)
invertTree(node.right)
node.left = node.right
node.right = node.left
return node