Same Tree
Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical and the nodes have the same value.
(判断二叉树是否相同)
Example:
1. 递归
判断节点值,左子树,右子树是否一致,具体实现方法如下:
1 | # Definition for a binary tree node. |