Skip to content

Commit 3037bf8

Browse files
authored
Update count-subtrees-with-max-distance-between-cities.cpp
1 parent 4418e6d commit 3037bf8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

C++/count-subtrees-with-max-distance-between-cities.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Solution {
5252
for (int child_d = 0; child_d < (*count)[child]; ++child_d) {
5353
for (int child_max_d = child_d; child_max_d < min(2 * child_d + 1, (*count)[child]); ++child_max_d) {
5454
new_dp_curr[max(curr_d, child_d + 1)][max({curr_max_d, child_max_d, curr_d + child_d + 1})] +=
55-
(*dp)[curr][curr_d][curr_max_d] * (*dp)[child][child_d][child_max_d];
55+
(*dp)[curr][curr_d][curr_max_d] * (*dp)[child][child_d][child_max_d]; // count subtrees with new child
5656
}
5757
}
5858
}

0 commit comments

Comments
 (0)