LeetCode 198. House Robber

class Solution {
public:
    int rob(vector<int>& nums) {
        vector<int> dp;
        int n = nums.size();
        dp.push_back(0);
        int ans = 0;
        for(int i=0;iint temp = 0;
            if(i==0) temp = nums[i];
            for(int j=0;jreturn ans;
    }
};

你可能感兴趣的:(LeetCode)