[leetcode] Same Tree
来源:互联网 发布:快手直播是什么软件 编辑:程序博客网 时间:2024/04/20 18:59
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.
class Solution {public: bool isSameTree(TreeNode *p, TreeNode *q) {// Start typing your C/C++ solution below// DO NOT write int main() functionif(!p && !q)return true;if(p && q && p->val==q->val)return isSameTree(p->left,q->left)&&isSameTree(p->right,q->right);elsereturn false;}};
- 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
- 将EXECL数据导进ALV报表并存进数据库
- Android开发者指南(6) —— AIDL
- 基础加强一
- 题目1391:顺时针打印矩阵-九度
- 接上外部系统调用规则引擎接口
- [leetcode] Same Tree
- linux端dos程序
- Spring启动后执行
- ffmpeg编码jpg为mp4文件
- android 与sqlite数据库
- oracle11g用户密码过期后修改办法
- java 四舍五入
- IOS7新特性分享
- 我的CSDN博客