Test case
|
|
Solution 1: accepted 0ms
Time: O(n), Space: O(1)
Based on the solution of House Robber 1, the only difference is that, we cannot rob both of the first and the last house at one time. So we assume two situations, one includes only the first house, the other includes only the last house.
|
|