Easy To Understand || Basic DFS using Recursion || Beats 100%🔥💯🧠
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * Definition for a binary tree node.\n * struct TreeNode {\n *     int val;\n *     TreeNode *left;\n *     TreeNode *right;\n *     TreeNode() : val(0), left(nullptr), right(nullptr) {}\n *     TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}\n *     TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}\n * };\n */\nclass Solution {\npublic:\n    int c=0;\n    bool flipEquiv(TreeNode* root1, TreeNode* root2) {\n        if(root1==NULL && root2==NULL){\n            return true;\n            cout<<c;\n        }\n        \n        if((root1 && !root2) || (root2 && !root1)){\n            return false;\n        }\n        if(root1->val!=root2->val){\n            return false;\n        }\n        if(root1->left &&  root2->left && root1->right && root2->right ){\n            if(root1->left->val==root2->right->val && root1->right->val==root2->left->val){\n               TreeNode* temp=root1->right;\n               root1->right=root1->left;\n               root1->left=temp;\n            }\n            c++;\n        }\n        if((root1->left && root2->right && root1->left->val==root2->right->val) || (root2->left && root1->right && root2->left->val==root1->right->val)){\n              TreeNode* temp=root1->right;\n               root1->right=root1->left;\n               root1->left=temp;\n               c++;\n        }\n        return flipEquiv(root1->left,root2->left) && flipEquiv(root1->right,root2->right);\n    }\n};\n```
['C++']