Invert Binary Tree

Understand and solve the interview question "Invert Binary Tree".

Description

In this lesson, your task is to invert a given binary tree, T.

Let’s look at an example below:

Coding exercise

main.cpp
TreeNode.h
#include "TreeNode.h"
TreeNode* invertTree(TreeNode* root) {
return root;
}
Invert binary tree

Solution

We can solve this problem using ...