Skip to content

Commit 31d00c9

Browse files
authored
Update count-subtrees-with-max-distance-between-cities.py
1 parent dff637b commit 31d00c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/count-subtrees-with-max-distance-between-cities.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def dfs(n, adj, curr, parent, lookup, count, dp):
2929
for child_max_d in xrange(child_d, min(2*child_d+1, count[child])):
3030
new_dp_curr[max(curr_d, child_d+1)][max(curr_max_d, child_max_d, curr_d+child_d+1)] += \
3131
dp[curr][curr_d][curr_max_d]*dp[child][child_d][child_max_d] # count subtrees with new child
32-
count[curr] += count[child] # merge child to count subtrees
32+
count[curr] += count[child] # merge new child
3333
dp[curr] = new_dp_curr
3434

3535
adj = collections.defaultdict(list)

0 commit comments

Comments
 (0)