5 ms·
This is all I remember now : An array represents a binary tree like this : 1 / \ 2 3 \ / 4 5 / 6 is represent
by sage76 9y ago
This is all I remember now :
An array represents a binary tree like this :
1
/ \
2 3
\ /
4 5
/
6
is represented as : 1 2 3 * 4 5 * 6
so apart from the last level, any missing child nodes are represented as *. You need to find the set of unconnected nodes whose sum is maximum. Child-parent relationship means they are connected.