Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3c20ac8

Browse files
refactor 100
1 parent1460518 commit3c20ac8

File tree

1 file changed

+2
-3
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+2
-3
lines changed

‎src/main/java/com/fishercoder/solutions/_100.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44

55
/**
66
* 100. Same Tree
7-
* <p>
87
* Given two binary trees, write a function to check if they are equal or not.
9-
* <p>
108
* Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
119
*/
1210

1311
publicclass_100 {
14-
//recursion idea flows out naturally.
12+
1513
publicbooleanisSameTree(TreeNodep,TreeNodeq) {
1614
if (p ==null ||q ==null) {
1715
returnp ==q;
1816
}
1917
returnp.val ==q.val &&isSameTree(p.left,q.left) &&isSameTree(p.right,q.right);
2018
}
19+
2120
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp