Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Invert Binary Tree (medium)

Problem Statement

Given the root of a binary tree, invert it.


Given the following two binary trees:


  • The number of nodes in both trees is in the range [0, 100].
  • -100 <= Node.val <= 100

Try it yourself

Try solving this question here:




Like the course? Get enrolled and start learning!