File tree 1 file changed +0
-38
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-38
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import com .fishercoder .common .classes .TreeNode ;
4
4
5
- /**
6
- * 572. Subtree of Another Tree
7
- *
8
- Given two non-empty binary trees s and t,
9
- check whether tree t has exactly the same structure and node values with a subtree of s.
10
- A subtree of s is a tree consists of a node in s and all of this node's descendants. The tree s could also be considered as a subtree of itself.
11
-
12
- Example 1:
13
- Given tree s:
14
-
15
- 3
16
- / \
17
- 4 5
18
- / \
19
- 1 2
20
- Given tree t:
21
- 4
22
- / \
23
- 1 2
24
- Return true, because t has the same structure and node values with a subtree of s.
25
-
26
- Example 2:
27
- Given tree s:
28
-
29
- 3
30
- / \
31
- 4 5
32
- / \
33
- 1 2
34
- /
35
- 0
36
-
37
- Given tree t:
38
- 4
39
- / \
40
- 1 2
41
- Return false.
42
- */
43
5
public class _572 {
44
6
45
7
public static class Solution1 {
You can’t perform that action at this time.
0 commit comments