Given the roots of two binary trees root1 and root2, determine whether the two trees are flip equivalent.
A flip operation on a binary tree consists of choosing any node and swapping its left and right subtrees. A binary tree is considered flip equivalent to another binary tree if one tree can be transformed into the other through some number of flip operations.
Return true if root1 and root2 are flip equivalent, or false otherwise.
Constraints:
The number of nodes in each tree is in the range
Each tree will have unique node values in the range
Given the roots of two binary trees root1 and root2, determine whether the two trees are flip equivalent.
A flip operation on a binary tree consists of choosing any node and swapping its left and right subtrees. A binary tree is considered flip equivalent to another binary tree if one tree can be transformed into the other through some number of flip operations.
Return true if root1 and root2 are flip equivalent, or false otherwise.
Constraints:
The number of nodes in each tree is in the range
Each tree will have unique node values in the range