I got stuck in this question . This is the question — "You are given a tree consisting of n nodes. Your task is to determine for each node the sum of the distances from the node to all other nodes."
Any help in understanding how to apply dp here will be much appreciated.