Find max sum of elements in a Binary Tree, such that you don't select the adjuscent nodes.
If node contains all negative numbers then return 0.
For example if the given root Node is like this:
3
/\
-1 15
/ \ / \
8 1 0 2Then the valid max tree is 15 + 8 + 1 = 24
Also read my onsite round experience: Google Onsite Mountain View