Build Status

Invert a Binary Tree

Invert a binary tree.

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

to

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

Data structures:

Scala:

case class TreeNode(value: Int, left: Option[TreeNode], right: Option[TreeNode])

Java:

public class TreeNode {
    int val;
    TreeNode left;
    TreeNode right;
    TreeNode(int x) { val = x; }
}

You can check contest bye-laws here.

Check out our Confitura 2015 site here

We are hiring! Visit our career site.