JavaScript 3-line solution
The key to understand this question is "some number of flip operations." We don\'t always have to swap the left and right child subtrees. So we have to consider
The key to understand this question is "some number of flip operations." We don\'t always have to swap the left and right child subtrees. So we have to consider two situations in our `return ` statement: \n\n(1) when the left and right subtrees are not flipped: check if the left and right of both trees are the same\n(2) OR, when the left and right subtrees are flipped: check if the left and right of both trees are flipped\n\n```\nconst flipEquiv = function(root1, root2) {\n  if (!root1 && !root2) return true; \n  if (!root1 || !root2 || root1.val !== root2.val) return false; \n  return flipEquiv(root1.left, root2.left) && flipEquiv(root1.right,root2.right) || flipEquiv(root1.left, root2.right) && flipEquiv(root1.right, root2.left);\n};\n```
[]