GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
← Coding & DSA / 76
mediumAmazonGoogle

House robber: max sum you can take from a row of houses without hitting two adjacent ones

The classic linear DP. At each house you either skip it and keep the best so far, or take it and add the best from two back. The signal is collapsing the table to two rolling variables and then handling the circular follow-up cleanly.

Updated Aug 2026 · Grounded in real Forward Deployed Engineer interview loops and written to a senior-engineer editorial bar.

The classic linear DP. At each house you either skip it and keep the best so far, or take it and add the best from two back. The signal is collapsing the table to two rolling variables and then handling the circular follow-up cleanly.

20 answers per topic instead of 10, plus saved progress and bookmarks · no cardor unlock all 559 remaining answers · ₹2,000 / $25

Every answer, concept and course, every paper breakdown, all published video lessons, hands-on FDE Lab missions, Premium PDF guides and companion files, the full practice-test bank and work-sample downloads. Referral Premium excludes guide PDFs and their companion files.

6 months · One payment · No auto-renewal

Study alongside free video lessons.

Keep practising

FEDITOR'S NOTE

Interviewers expect the O(1)-space version once you have the recurrence. The real differentiator is House Robber II: a circular street where the first and last house are now adjacent. Candidates who try to special-case the wrap-around with conditionals usually tie themselves in knots. The clean move is to run the linear solver twice on two slices and take the max.

DISCUSSION · 0

No comments yet — be the first to share your approach.