Easy C++ Approach with intuition, beating 100% (0ms)
Intuition\n Describe your first thoughts on how to solve this problem. \nThe intuition is similar with the question to check if two Binary trees are equivalent 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe intuition is similar with the question to check if two Binary trees are equivalent or not, or the other question if they are mirror of each other with just changed valid conditions for this particular question.\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\t1.\tBase Cases:\n\t\u2022\tIf both nodes are NULL, they are considered equivalent.\n\t\u2022\tIf one is NULL but the other isn\u2019t, they aren\u2019t equivalent.\n\t\u2022\tIf their values differ, they aren\u2019t equivalent.\n\t2.\tRecursive Check:\n\t\u2022\tFirst, we check if the children without flipping are the same \n\t\u2022\tThen, we check if flipping the children makes the trees equivalent \n\t3.\tReturn: Either the trees are equivalent without a flip or with a flip.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n        O(n), because each node is visited once during the comparison.\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n        Recursive stack space\n\n# Code\n```cpp []\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    bool dfs(TreeNode* one, TreeNode* two){\n\n        if(one == NULL && two == NULL)  return true;\n        if(one == NULL || two == NULL)  return false;\n        if(one->val != two->val)        return false;\n\n        bool noFlip = dfs(one->left, two->left) && dfs(one->right, two->right);\n        bool flip = dfs(one->left, two->right) && dfs(one->right, two->left);\n\n        return noFlip | flip;  \n    }\n    bool flipEquiv(TreeNode* root1, TreeNode* root2) {\n        \n        return dfs(root1, root2);\n\n    }\n};\n```
['C++']