We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dff637b commit 31d00c9Copy full SHA for 31d00c9
Python/count-subtrees-with-max-distance-between-cities.py
@@ -29,7 +29,7 @@ def dfs(n, adj, curr, parent, lookup, count, dp):
29
for child_max_d in xrange(child_d, min(2*child_d+1, count[child])):
30
new_dp_curr[max(curr_d, child_d+1)][max(curr_max_d, child_max_d, curr_d+child_d+1)] += \
31
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
+ count[curr] += count[child] # merge new child
33
dp[curr] = new_dp_curr
34
35
adj = collections.defaultdict(list)
0 commit comments