Skip to content

Commit 4418e6d

Browse files
authored
Update count-subtrees-with-max-distance-between-cities.py
1 parent ed104ff commit 4418e6d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ def dfs(n, adj, curr, parent, lookup, count, dp):
4444
count = [1]*n
4545
dfs(n, adj, i, -1, lookup, count, dp) # Time: O(k^5), k is the number of the remaining cities
4646
lookup[i] = 1
47-
for d in xrange(1, n):
48-
for max_d in xrange(d, min(2*d+1, n)):
47+
for d in xrange(1, n): # for each depth from city i
48+
for max_d in xrange(d, min(2*d+1, n)): # for each max distance
4949
result[max_d-1] += dp[i][d][max_d]
5050
return result
5151

0 commit comments

Comments
 (0)