Recognize this as the classic House Robber dynamic programming problem. Explain that you'll use DP to compute the maximum loot up to each house by considering whether to rob it (and add the loot from two houses back) or skip it (and keep the previous maximum). Then provide the recurrence relation and discuss optimization to O(1) space.
Pro tip: Mention that this problem is a simplified version of the weighted independent set on a path, and that the DP solution generalizes to more complex graph structures. Also, clarify that the input is an array of non-negative integers and that you assume you can't rob adjacent houses.
Confirm that the houses are in a line, each has a non-negative amount, and you cannot rob adjacent houses. Ask if the input is an array and if you need to return the maximum amount only.
Let dp[i] be the maximum amount you can rob from the first i houses. The recurrence is dp[i] = max(dp[i-1], dp[i-2] + nums[i-1]).
Set dp[0] = 0, dp[1] = nums[0]. Iterate from i=2 to n, applying the recurrence. Return dp[n].
Observe that only the last two DP values are needed, so use two variables (prev2 and prev1) to achieve O(1) space complexity.
State that the time complexity is O(n) and space complexity is O(1) after optimization. Discuss edge cases like empty array or single house.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.