Java recursive solution faster than 100%
\nclass Solution {\n    public boolean flipEquiv(TreeNode root1, TreeNode root2) {\n        if(root1!=null && root2!=null && root1.val != root2.val){\n         
```\nclass Solution {\n    public boolean flipEquiv(TreeNode root1, TreeNode root2) {\n        if(root1!=null && root2!=null && root1.val != root2.val){\n            return false;\n        }\n        \n        return dfs(root1, root2);\n    }\n    \n    private boolean dfs(TreeNode root1, TreeNode root2){\n        if(root1==null && root2==null){\n            return true;\n        }else if(root1==null || root2==null || root1.val != root2.val){\n            return false;\n        }else{            \n            return (dfs(root1.left, root2.left) && dfs(root1.right, root2.right) || (dfs(root1.right, root2.left) && dfs(root1.left, root2.right)));\n        }\n    }\n}\n```
[]