Please read the new rule regarding the restriction on the use of AI tools. ×

how to solve this problem ?

Revision en1, by learner_321, 2017-12-24 15:14:30

Given a binary tree,where each node has value given x, (x>=0).

you need to find maximum sum of nodes's x value ,but you can not select two nodes in the answer such that one node is parent (only immediate),ans other is child.

like if 1 is root , and its left child is 2 and right child is 3 ,then you can not include 1 and 2, or 1 and 3 in the answer.

find maximum possible sum...

Tags #trees

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English learner_321 2017-12-25 06:41:31 27 Tiny change: 'ble sum...' -> 'ble sum...\n\nNumber of nodes<= (1e6)'
en2 English learner_321 2017-12-24 15:15:31 26
en1 English learner_321 2017-12-24 15:14:30 415 Initial revision (published)