Why must the answer be a level scan one and another?


  • 0
    L

    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:
    ----1
    --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?


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.