[LeetCode] Count Subtrees With Max Distance Between Cities

1 · · Feb. 2, 2022, 10:39 a.m.
1617. Count Subtrees With Max Distance Between Cities There are n cities numbered from 1 to n. You are given an array edges of size n-1, where edges[i] = [ui, vi] represents a bidirectional edge between cities ui and vi. There exists a unique path between each pair of cities. In other words, the cities form a tree. A subtree is a subset of cities where every city is reachable from every other city in the subset, where the path between each pair passes through only the cities from the subset. Tw...