Search⌘ K
AI Features

Sum of Distances in a Tree

Sum of Distances in a Tree gives you a connected tree through its edges and asks you to return an array whose each entry is the total distance from that node to every other node.

Statement

Given a connected, undirected tree with n nodes, labeled from ...