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

Commitd2f502c

Browse files
refactor 1315
1 parentb0fba81 commitd2f502c

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

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

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,6 @@
22

33
importcom.fishercoder.common.classes.TreeNode;
44

5-
/**
6-
* 1315. Sum of Nodes with Even-Valued Grandparent
7-
*
8-
* Given a binary tree, return the sum of values of nodes with even-valued grandparent.
9-
* (A grandparent of a node is the parent of its parent, if it exists.)
10-
* If there are no nodes with an even-valued grandparent, return 0.
11-
*
12-
* Example 1:
13-
* 6
14-
* / \
15-
* 7 8
16-
* / \ / \
17-
* 2 7 1 3
18-
* / / \ \
19-
* 9 1 4 5
20-
*
21-
* Input: root = [6,7,8,2,7,1,3,9,null,1,4,null,null,null,5]
22-
* Output: 18
23-
* Explanation: The red nodes are the nodes with even-value grandparent while the blue nodes are the even-value grandparents.
24-
*
25-
* Constraints:
26-
* The number of nodes in the tree is between 1 and 10^4.
27-
* The value of nodes is between 1 and 100.
28-
* */
295
publicclass_1315 {
306
publicstaticclassSolution1 {
317
publicintsumEvenGrandparent(TreeNoderoot) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp