Java recursion
\npublic boolean flipEquiv(TreeNode root1, TreeNode root2) {\n        if (root1 == null || root2 == null) {\n            return root1 == root2;\n        }\n    
````\npublic boolean flipEquiv(TreeNode root1, TreeNode root2) {\n        if (root1 == null || root2 == null) {\n            return root1 == root2;\n        }\n        if (root1.val != root2.val) {\n            return false;\n        } \n        return (flipEquiv(root1.left, root2.left) && flipEquiv(root1.right, root2.right))\n            || (flipEquiv(root1.left, root2.right) && flipEquiv(root1.right, root2.left));\n        \n    }\n````
[]