Skip to main content

House Robber

Learn House Robber (Dynamic Programming, Advanced DSA) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Maximize Loot Without Robbing Two Adjacent Houses At each house, choose: SKIP it (carry forward the best result without it), or ROB it (its value plus the best result from two houses back, since the adjacent one can't also be robbed). dp[i] = max(dp[i-1], dp[i-2] + nums[i]) .

More lessons in Dynamic Programming