Loading problem…
This problem builds on house-robber-ii. Complete that first, then load your solution to continue.
Houses form a nonempty binary tree. Each node value is the money in that house. You may choose any set of houses, but cannot choose two houses joined directly by a parent-child edge.
Return the maximum total money you can collect. Siblings may both be chosen; a grandparent and grandchild may both be chosen.
Example inputs use level-order arrays with null for missing children. Your function receives a TreeNode object.
Example 1:
Example 2:
Example 3: