The requirement of the problem is : It will automatically contact the police if two directly-linked houses were broken into on the same night.
So consider the example as below:
--8 - 1
-1 1 1 9
We can rob 8 & 9 without violating the rule since the two nodes are now not directly-linked. However, this is maximum but not got from odd levels' sum or even levels' sum. Could anyone help me about this?