Is this all-pairs shortest path problem?
I don't think so, as the count of n (no. of vertices) is not given, using O(n^3) Floyd-Warshall could be a pain. Rather one can exploit the fact that its a binary tree. Good Luck!
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.