43: Invert binary tree

Given a binary tree. Write a method to invert this tree

 

Example 1

Input:        1
             / \
            2   3
           / \ / \
          4  5 6  7

Output:       1
             / \
            3   2
           / \ / \
          7  6 5  4

Example 2

Input:     1   
            \  
             3 

Output:    1   
          /    
         3