LeetCode - Same Tree
来源:互联网 发布:abb机器人编程调试 编辑:程序博客网 时间:2024/05/29 16:30
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
bool isSameTree(TreeNode *p, TreeNode *q) { if ((p == NULL) && (q == NULL)) { return true; } else if ((p == NULL) || (q == NULL)) { return false; } else { } if (p->val != q->val) { return false; } return isSameTree(p->left, q->left) && isSameTree(p->right, q->right);}
- Leetcode - Tree - Same Tree
- [leetcode][tree] Same Tree
- LeetCode: Same Tree
- LeetCode Same Tree
- [Leetcode] Same Tree
- LeetCode : Same Tree
- [LeetCode] Same Tree
- leetcode 65: Same Tree
- Leetcode 100 Same Tree
- [leetcode] Same Tree
- [LeetCode]Same Tree
- [leetcode]Same Tree
- [Leetcode]Same Tree
- Leetcode: Same Tree
- [LeetCode] Same Tree
- LeetCode-Same Tree
- [leetcode] Same Tree
- LeetCode - Same Tree
- rails学习之windows下环境搭建及项目创建(图文并茂,简单易懂)
- 多玩LOL盒子 3.5.1
- PKU3013(Big Christmas Tree)-最短路径-SPFA
- 动态规划求解最长公共子串
- GDB 详解
- LeetCode - Same Tree
- 局域网内配置路由器(包括无线功能)
- [Ruby学习总结]Ruby中的类
- SQL(一) cursor用法
- struts2 中action返回的类型
- lua编译
- Ubuntu下配置samba实现文件夹共享
- 发人深省的21个故事
- 面试题之中位数的应用POJ1723