I think for only two elements the test case is wrong

  • 0

    if only two houses, we can not rob either of them. Because as stated in the question, the first house to connected to the second, and then the second is also connected to the first, to form a two-point loop.

  • 0

    If we rob the first house, the second is its neighbor in both side view. So we still could rob the first house.

Log in to reply

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