Problem Statement
Given the root of a binary tree, invert it.
Example:
Given the following two binary trees:
![Image](/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fdownload%2Fstorage%2Fv1%2Fb%2Fdesigngurus-prod.appspot.com%2Fo%2FdocImages%252F63a5d0ebdbef8ba7bc319ab0%252Fimg%3A55eff56-b26b-fae-25a-0406d7a10d5.jpg%3Fgeneration%3D1671811354479701%26alt%3Dmedia&w=3840&q=75)
Constraints:
- 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:
Python3
Python3