-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution100.java
More file actions
36 lines (30 loc) · 810 Bytes
/
Copy pathSolution100.java
File metadata and controls
36 lines (30 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* @Title: Solution100.java——
* @Package EasyCode_01
* @Description: TODO
* @author msdumin@gmail.com
* @date 2019年4月3日 下午3:20:11
* @version V1.0
*/
package EasyCode_01;
/**
* @ClassName: Solution100——相同的树
* @Description: TODO
* @author msdumin@gmail.com
* @date 2019年4月3日 下午3:20:11
*/
public class Solution100 {
//递归解法
/* public boolean isSameTree(TreeNode p, TreeNode q) {
if(p == null && q == null)
return true;
if((p != null && q == null) || (p == null) && (q != null))
return false;
if(p.val != q.val)
return false;
return (isSameTree(p.left, q.left) && isSameTree(p.right, q.right));
}*/
//迭代解法
public boolean isSameTree(TreeNode p, TreeNode q) {
}
}