Invert the Binary Tree

Given a binary tree, invert the binary tree and return it.
Look at the example for more details.

Example :
Given binary tree

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

invert and return

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

Interview Code Editor
Hints
  • Solution Approach
  • Complete Solution
5551 successful submissions.
Asked In:
  • Google
Click here to jump start your coding interview preparation