Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 179b08a

Browse files
authoredApr 30, 2022
Update 1522.Diameter-of-N-Ary-Tree.cpp
1 parent 065f415 commit 179b08a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎Tree/1522.Diameter-of-N-Ary-Tree/1522.Diameter-of-N-Ary-Tree.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ class Solution {
3939
if (n>=2)
4040
{
4141
ret = max(ret, depths[0]+depths[1]+1);
42-
return depths.back()+1;
42+
return depths[0]+1;
4343
}
4444
else if (n==1)
4545
{
4646
ret = max(ret, depths[0]+1);
47-
return depths.back()+1;
47+
return depths[0]+1;
4848
}
4949
else
5050
{

0 commit comments

Comments
 (0)
Please sign in to comment.