LeetCode 226

Invert Binary Tree

Concepts:

Tree

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

Optimal Approach

Recursively invert the left and right subtrees of the current node.

Time: O(n)

Space: O(1), Recursive stack space: O(n)

All Problems