Runtime beats 100.%, memory 16.56 beats 57.29% [EXPLAINED]
Intuition\nCheck if two trees can become the same by flipping some subtrees. For each node, we have two choices: compare the children as they are or compare the
# Intuition\nCheck if two trees can become the same by flipping some subtrees. For each node, we have two choices: compare the children as they are or compare them flipped. If we can match both trees this way, they are equivalent.\n\n# Approach\nRecursively compare the two trees by checking if the left and right children match either in the same order or flipped, for every node.\n\n# Complexity\n- Time complexity:\nO(min(N1, N2)) \u2013 We only visit each node once, stopping when one tree finishes.\n\n- Space complexity:\nO(min(H1, H2)) \u2013 The maximum depth of recursion is the height of the smaller tree.\n\n# Code\n```python3 []\nclass Solution:\n    def flipEquiv(self, root1: \'TreeNode\', root2: \'TreeNode\') -> bool:\n        # If both roots are None, they are trivially equivalent\n        if not root1 and not root2:\n            return True\n        # If only one is None, they cannot be equivalent\n        if not root1 or not root2:\n            return False\n        # If the values of the nodes differ, they cannot be equivalent\n        if root1.val != root2.val:\n            return False\n        \n        # Check flip and no-flip conditions\n        return (self.flipEquiv(root1.left, root2.left) and self.flipEquiv(root1.right, root2.right)) or \\\n               (self.flipEquiv(root1.left, root2.right) and self.flipEquiv(root1.right, root2.left))\n\n```
['Python3']