# Invert binary tree

A problem that Homebrew's author complained.

Invert a binary tree. Problem from leetcode.

Given the root of a binary tree, invert the tree, and return its root.

Here's the input:

and the out put looks like:

This problem was inspired by this tweet.

Here's the solution implemented in Java.

There's much different logic behind software engineering with computer science. Max replied this question about it on quora.com after 2 years.