47. Same Tree

Return true if the two binary trees have the same shape and the same values at every node.

Example 1

Input: p = [1,2,3], q = [1,2,3]
Output: true

Example 2

Input: p = [1,2], q = [1,null,2]
Output: false
Hint 1

Compare roots, then recursively compare left with left and right with right.

TreeDFS