Maximum Path sum in tree

Правка en1, от vrkorat211, 2020-08-23 11:46:18

Question asked in Google online coding competition 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:

Теги #trees, path-sum, #help

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский vrkorat211 2020-08-23 11:48:59 14 Tiny change: 'e coding competition on 22nd A' -> 'e coding challenge on 22nd A'
en2 Английский vrkorat211 2020-08-23 11:47:58 16
en1 Английский vrkorat211 2020-08-23 11:46:18 781 Initial revision (published)