Question asked in Google online coding challenge on 22nd AUG, 2020.
Please help me with this question.
You are given a tree with N nodes numbered 1 to N. Each node is having weight Ai. (1 <= i <= N)
Find the maximum path sum between any two node u and v of the tree. Return the maximum path sum value. constraints:
1 <= T <= 10
1 <= N <= 1e4
-1e6 <= Ai <= +1e6
Example: