✅ C++ 100% faster || Most efficient solution || Easy DFS
\n# Code\n\nclass Solution {\npublic:\n    bool flipEquiv(TreeNode* root1, TreeNode* root2) {\n        if(!root1 && !root2)\n            return true;\n        i
\n# Code\n```\nclass Solution {\npublic:\n    bool flipEquiv(TreeNode* root1, TreeNode* root2) {\n        if(!root1 && !root2)\n            return true;\n        if(!root1 || !root2 || root1->val != root2->val)\n            return false;\n        \n        bool left1, right1, left2, right2;\n\n        left1 = flipEquiv(root1->left, root2->left);\n        right1 = flipEquiv(root1->right, root2->right);\n        left2 = flipEquiv(root1->left, root2->right);\n        right2 = flipEquiv(root1->right, root2->left);\n\n        return ((left1 && right1) || (left2 && right2));\n    }\n};\n```\n# Please upvote, if you find this helpful \uD83D\uDE4F \n### Thank you in advance ;)
['C++']