We are given a hierarchy of a company as a tree form and each node in tree has a contribution
We are given an array of these contributions as Level wise traversal of tree
(So we were not given tree or edges ..but I used
ith node has its children 2*i and 2*i + 1 position)
Now we need to maximise our score
1. If it choose manager i cant choose its children
2. If the manager is key manager (the node which has both children is called key manager node) either we can choose it and use rule 1
3. Or If I don't want to choose key manager choose one its children not both atmost one