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

Commit81f113f

Browse files
refactor 1361
1 parentd1016cd commit81f113f

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

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

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,6 @@
55
importjava.util.List;
66
importjava.util.Map;
77

8-
/**
9-
* 1361. Validate Binary Tree Nodes
10-
*
11-
* You have n binary tree nodes numbered from 0 to n - 1 where node i has two children leftChild[i] and rightChild[i],
12-
* return true if and only if all the given nodes form exactly one valid binary tree.
13-
* If node i has no left child then leftChild[i] will equal -1, similarly for the right child.
14-
* Note that the nodes have no values and that we only use the node numbers in this problem.
15-
*
16-
* Example 1:
17-
* Input: n = 4, leftChild = [1,-1,3,-1], rightChild = [2,-1,-1,-1]
18-
* Output: true
19-
*
20-
* Example 2:
21-
* Input: n = 4, leftChild = [1,-1,3,-1], rightChild = [2,3,-1,-1]
22-
* Output: false
23-
*
24-
* Example 3:
25-
* Input: n = 2, leftChild = [1,0], rightChild = [-1,-1]
26-
* Output: false
27-
*
28-
* Example 4:
29-
* Input: n = 6, leftChild = [1,-1,-1,4,-1,-1], rightChild = [2,-1,-1,5,-1,-1]
30-
* Output: false
31-
*
32-
* Constraints:
33-
* 1 <= n <= 10^4
34-
* leftChild.length == rightChild.length == n
35-
* -1 <= leftChild[i], rightChild[i] <= n - 1
36-
* */
378
publicclass_1361 {
389
publicstaticclassSolution1 {
3910
publicbooleanvalidateBinaryTreeNodes(intn,int[]leftChild,int[]rightChild) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp