Python Solution | 100% | O(N) | Easy solution | 5 lines Solution
Intuition\n Describe your first thoughts on how to solve this problem. \njust think about two smallest posible trees\n\n\n    root1\nleft     right\n\n\n\n    r
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\njust think about two smallest posible trees\n\n```\n    root1\nleft     right\n```\n\n```\n    root2\nleft     right\n```\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n\nNow to be flip equivalent both root\'s values should either be None\nor be same\n\nif both are None, the game is over its flip flip ...Bye bye tata..\n\nbut if its not, then check for their children\nthere are two posiblities they can either be flipped or not-flipped\n\nin case of flip check:\n```\nflipEquiv(root1.left, root2.right) && flipEquiv(root1.right, root2.left)\n```\n\nin case of no flip check :\n```\nflipEquiv(root1.right, root2.right) && flipEquiv(root1.left, root2.left)\n```\n\neither of above two condition should be true to make these trees equivalent\n\n\n\n# Complexity\n- Time complexity: <!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n)\nn= number of nodes\n\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n\n- Space complexity:<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(n)\nn= number of nodes\n\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python []\n# Definition for a binary tree node.\n# class TreeNode(object):\n#     def __init__(self, val=0, left=None, right=None):\n#         self.val = val\n#         self.left = left\n#         self.right = right\nclass Solution(object):\n    def flipEquiv(self, root1, root2):\n        """\n        :type root1: Optional[TreeNode]\n        :type root2: Optional[TreeNode]\n        :rtype: bool\n        """\n        if (root1 == None and root2 == None):\n\t        return True\n\n        if ((root1 != None and root2 != None) and (root1.val == root2.val)):\n            return ( self.flipEquiv(root1.left, root2.left) and self.flipEquiv(root1.right, root2.right) or  (self.flipEquiv(root1.right, root2.left) and self.flipEquiv(root1.left, root2.right)))\n        \n        return False\n        \n```
['Tree', 'Recursion', 'Binary Tree', 'Python']