【代码随想录算法训练Day45】LeetCode 198.打家劫舍、LeetCode 213.打家劫舍II、LeetCode 337.打家劫舍III
Day45动态规划第七天LeetCode198.打家劫舍dp数组含义:考虑偷前i家后的最大钱币为dp[i]递推公式:dp[i]=max(dp[i-2]+nums[i],dp[i-1])初始化:dp[0]=nums[0],dp[1]=max(dp[0],dp[1]),dp[i]=任意值遍历顺序:从小到大classSolution{public:introb(vector&nums){intn=num