Flip Equivalent Binary Trees
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
A **flip** on a binary tree picks a node and swaps its left and right child subtrees.
Two binary trees are **flip equivalent** if some sequence of flips (possibly none) turns the first tree into the second. Given the roots root1 and root2, return true if they are flip equivalent and false otherwise.
Within each tree all values are distinct. Two empty trees are flip equivalent.
Examples
Constraints
- 0 <= number of nodes in each tree <= 100
- 0 <= Node.val <= 199
- Values within each tree are distinct
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.