[LintCode] Invert Binary Tree
public void invertBinaryTree(TreeNode root) { // write your code here if(root == null) return; invertBinaryTree(root.left); invertBinaryTree(root.right); TreeNode left = root.left; root.left = root.right; root.right = left; }
Leave A Comment