Leetcode_100Same Tree
来源:互联网 发布:大雄的生化危机 知乎 编辑:程序博客网 时间:2024/04/30 09:04
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.
public boolean isSameTree(TreeNode p, TreeNode q) { if (p==null&&q==null) return true; if(p==null ||q==null||q.val!=p.val) return false; return isSameTree(p.left, q.left) &&isSameTree(p.right, q.right); }}
0 0
- Leetcode_100Same Tree
- Tree
- tree
- tree
- TREE
- Tree
- Tree
- tree
- tree
- tree
- tree
- tree
- tree
- Tree
- Tree
- tree
- TREE
- tree
- X86 内存布局分析(Memory map)
- HDU-1091-A+B for Input-Output Practice (III)(继续水)
- Chapter 5. Forms
- Delphi LoadUserProfile
- Web应用遇到问题记录
- Leetcode_100Same Tree
- Tinkpad E450 U盘启动
- envi 监督分类超详细过程
- DATAGRID固定表头【转】
- Android SnackBar
- MBR & GPT
- LeetCode - Largest Number (sort的cmp的写法)
- 项目练习:自己写一个CheckBoxList,RadioButtonList控件
- 单例设计模式