End of Year Sale: Use Coupon Code END2025 to Get Extra 25% Off.
g with size n x n to represent the graph, setting the distance between each pair of nodes to a large number (e.g., 999) except for the distance between directly connected nodes, which is set to 1.ans to store the count of subtrees for each possible diameter.ans array.ans array.