Evan Hong

I will be chronicling my journey through Sean Prashed’s excellent LeetCode Patterns from Easy to Hard using my trusty programming language Python. Today we will be tackling the Invert Binary Tree question from LeetCode. As always, this is a solution and not the solution. The beauty of programming is that there are many approaches to the same result.

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

Solution Code

Runtime Complexity: O(V) where V is the number of nodes

--

--