Compute distance-sum from every tree node | Google Interview Question