网站介绍:文章浏览阅读447次。Recursive对于s的每一个节点,我们都要调用isSame来判断两棵树是否相同。时间复杂度 O(mn)class Solution {public: bool isSubtree(TreeNode* s, TreeNode* t) { if (s==NULL && t==NULL) return true; ...
- 链接地址:https://blog.csdn.net/weixin_30507269/article/details/102004097
- 链接标题:LeetCode 572. Subtree of Another Tree-CSDN博客
- 所属网站:blog.csdn.net
- 被收藏次数:6876
- 网站标签:LeetCode 572. Subtree of Another Tree