House Robber
overlap subproblem: maxProfit(n) is related to its two former subproblems, maxProfit(n - 1) and maxProfit(n - 2)
optimal structure: 同时如果 maxProfit(n - 1) 和 maxProfit(n - 2) 都是其对应子问题的最优解的话,我们可以只利用这两个子问题的 solution,加上对当前元素的判断,构造出 maxProfit(n) 的最优解。
state: maxProfit(n) is the best profit for the first n houses
function: maxProfit(n) = Math.max(maxProfit(n - 1), maxProfit(n - 2) + profit(n))
Don't rub so just carry over the profit from the previous house; or rub the current house and inherit the profit from the n-2 house