Given the roots of two binary trees p and q, check if they are the same or not. Two binary trees are the same if they are structurally identical and the nodes have the same values.
Input: p = [1,2,3], q = [1,2,3]
Output: true
Topics: trees
Asked by: Amazon, Microsoft, Bloomberg
Time complexity: O(min(m, n)). Space complexity: O(min(m, n)).