Learn
Practice
Newsletter
Resources
F
Toggle theme
0
F
Toggle theme
0
Toggle menu
← Back to All Animations
Sum of Distances in Tree
Bookmark
Input
Standard
Small
Path
Custom
n
=
6
,
edges
=
[[0,1],[0,2],[2,3],[2,4],[2,5]]
0
1
2
3
4
5
count[]
0
1
1
1
2
1
3
1
4
1
5
1
answer[]
0
0
0
0
0
0
Default
Pass 1
Pass 2
Done
algo
master
.
io
Step:
Start: Sum of Distances in Tree
0 / 29
Input
Standard
Small
Path
Custom
n
=
6
,
edges
=
[[0,1],[0,2],[2,3],[2,4],[2,5]]
0 / 29
0
1
2
3
4
5
count[]
0
1
1
1
2
1
3
1
4
1
5
1
answer[]
0
0
0
0
0
0
Default
Pass 1
Pass 2
Done
algo
master
.
io
Step:
Start: Sum of Distances in Tree