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

Commit5663b52

Browse files
add 2331
1 parentff116c7 commit5663b52

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|------|----------------|------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|----------------------------------|-------------
11+
| 2331|[Evaluate Boolean Binary Tree](https://leetcode.com/problems/evaluate-boolean-binary-tree/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2331.java)|| Easy||
1112
| 2326|[Spiral Matrix IV](https://leetcode.com/problems/spiral-matrix-iv/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2326.java)|| Medium||
1213
| 2325|[Decode the Message](https://leetcode.com/problems/decode-the-message/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2325.java)|| Easy||
1314
| 2319|[Check if Matrix Is X-Matrix](https://leetcode.com/problems/check-if-matrix-is-x-matrix/)|[Java](../master/src/main/java/com/fishercoder/solutions/_2319.java)|| Easy||
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
packagecom.fishercoder.solutions;
2+
3+
importcom.fishercoder.common.classes.TreeNode;
4+
5+
publicclass_2331 {
6+
publicstaticclassSolution1 {
7+
publicbooleanevaluateTree(TreeNoderoot) {
8+
if (root ==null) {
9+
returntrue;
10+
}
11+
if (root.left ==null &&root.right ==null) {
12+
if (root.val ==0) {
13+
returnfalse;
14+
}else {
15+
returntrue;
16+
}
17+
}
18+
if (root.val ==2) {
19+
returnevaluateTree(root.left) ||evaluateTree(root.right);
20+
}else {
21+
returnevaluateTree(root.left) &&evaluateTree(root.right);
22+
}
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp