LeetCode 572 Subtree of Another Tree. You're given two binary trees, root and subRoot. Return true if there's a subtree of root that matches subRoot exactly (same structure and values). Amazon interviewers use tree matching problems to test your recursive comparison skills.
For example, if root = [3,4,5,1,2] and subRoot = [4,1,2], return true because the left subtree rooted at 4 matches subRoot node for node.
Think about this: you need to check every node in root as a potential starting point. For each one, how do you verify an exact match?
Constraints: node count up to , values from to .