Explanation
House Robber II is a Medium interview problem tagged [Array, Dynamic Programming]. The winning approach is typically **DP**.
#213
House Robber II
You must solve the interview problem titled "House Robber II".
Difficulty: Medium. Topics: Array, Dynamic Programming. Primary pattern: DP.
Read the title as the specification: implement the exact behavior it names, return the correct output type, and aim for an interview-optimal DP solution. Use the examples to lock input/output format, then confirm edge cases (empty, single element, duplicates, extremes).
Example 1
Input: sample input for House Robber II
Output: sample output for House Robber II
Apply a DP approach and match the required return type.
Example 2
Input: edge-case input for House Robber II
Output: edge-case output for House Robber II
Verify empty/single/boundary behavior.
House Robber II is a Medium interview problem tagged [Array, Dynamic Programming]. The winning approach is typically **DP**.
Overlapping subproblems are solved once and reused.
Define dp state → write transition → fill base cases → iterate in dependency order.
Pattern-level skeleton only — not this problem’s exact answer. Adapt it to the statement.
Time: O(n)
Space: O(n)
Before coding, restate the problem, name the pattern (DP), and write the invariant or DP state in one sentence.
Got it?
Mark #213 House Robber II as understood when the pattern clicks.