Thank you~

```
class Solution {
public:
int rob(vector<int>& nums) {
if(nums.size() <= 0){
return 0;
}
int prev = nums[0];
int cur = nums[1];
for(int i = 2; i < nums.size(); i ++){
int temp = cur;
cur = max(prev + nums[i], cur);
prev = temp;
}
return cur;
}
};
```