9: Same tree
Given two binary trees
, write a method to check if the trees are the same
or not.
Example 1
Input: 1 1
/ \ / \
5 3 5 3
Output: true
Example 2
Input: 1 1
/ \ / \
2 3 5 3
Output: false
Explanation:
Left nodes
have different values
Helpful article